Table methods not working anymore - axapta

I have a table with different methods, for example, one of them is validateWrite, when setting Field A to value X, Field B and C has to be filled in.
Suddenly (without changing code, I have compared the code with the test enviroment, it does work there) the validateWrite has stopped working.
I have tried to recompile the table, but that did not work.
Any idea why it suddenly (without making other modifications in this enviroment, or generating a CIL) stopped working and what i can try to solve it?

If some piece of code is calling table.doInsert(), it skips the validateWrite() method.
If the environments are truly identical, then I would try closing your AX client and deleting your user caches (see http://dynamics-ax-live.blogspot.com/2010/03/more-information-about-auc-file.html) where you delete all of the *.auc files located at C:\Users\[Username]\AppData\Local
In addition to what that tells you to delete, I'd also remove the *.kti file and all of the files & folders inside of C:\Users\[UserName]\AppData\Local\Microsoft\Dynamics Ax
Then open AX, see if the problem still exists. Then full system compile, CIL build, and delete your usage data.
The preferred route though would be to just drop a breakpoint in and debug the code to see what the execution stack is.

Related

Could not find file <table> in database <dbname> - Progress 4GL

I am facing one critical issue in production which is happening randomly. I compiled a. p along with custom tables. And also, respective triggers (WRITE) linked with particular tables in a database which will be fired when the tables get affected. Now the thing is the . r file is central, trigger files and custom df loaded in required site (Called site 1).
When I am executing the menu in other site below error I am getting. Note - For other site I cannot promote trigger files and load custom df as it is not needed..in a. p we have a condition to check. If the condition gets success, then only the logic I have written for custom tables get affected. In this scenario except site 1 none of the site the condition will not be satisfied. but I am not sure why am getting this error..do I need to load the df file and linke all trigger files to all the sites even though it is not required? or what is the issue
/global/mfgpro/opt/prod/global/fin/customcode/xxxx.r --Could not find file in database . (1494)
This error message should also generate a protrace. file in the working directory of the session that generated the message. That protrace should tell you what line number the error occurred on and how you got there.

Qt::QTableWidget->setRowCount(0) crashes the application in release build?

I have a QTableWidget with 3 columns and 1000 rows (depends on the number of fetched items from the database ).
I also have a "Reload" Button to reload all the items from the database.
In "Reload" button, I want to delete all the rows from QTableWidget before loading items from the database.
Deleting all rows from the QTableWidget crashes the application when rowcount = 1.
I am using following logic to delete all the rows.
if( ui->tableWidget->rowCount() > 0)
{
ui->tableWidget->setRowCount(0);
}
also tried below logic
while (ui->tableWidget->rowCount() > 0)
{
ui->tableWidget->removeRow(0);
}
My application crashes using either of the logic when rowCount = 1.
It happens only when i build my application in release mode while it works fine in debug mode.
Can i get any idea why my application is getting crash.
I had the same problem, from one day to another it stopped working and I couldn't find what part of my code was making my program crash.
My program was used for reading files from a folder and uploading the file information into a QTableWidget, and I was also using cellWidgets for some information.
These are the problems that came to my mind, you should check that they're not happening to you:
The program was modifying the table all the time, so maybe i was trying to access an empty table. So I commented the lines where I was calling the table row and debugged it, but this wasn't a problem.
It could be a debugger problem, so I tried building it in Release and Profile mode, but still didn't work.
I could be having a problem when trying to access the cellWidget information, so I checked and I wasn't trying to access it.
Maybe the problem was when I was trying to eliminate a row that had a cellWidget, so I tried using ui->tableWidget->clearContents() before setting the row count to 0, (Didn't work)
After trying all of these I came upon this post. And basically I replaced setRowCount(0) with it's internal implementation ui->table->model()->removeRows(0,ui->table->rowCount());, debugged it and it worked.

Why creating model in any other location than client, meteor runtime throws exception?

I am a meteor newbie. I am trying out by building a simple app and it does nothing but shows list of items. I first tried out with hard coded model values in my client javascript code and it worked just fine. I then created a folder called 'model' under root of the application and created the model there like the following
Favorites = new Meteor.collection("favorites")
with this change, meteor throws exception pointing to this line of the file on load. If I move this code to client the code works ofcourse that is wrong. The full code is # https://github.com/ksunair/13favs It is a very simple solution has few files and less than 20 or 30 lines altogether. My client code is,
Template.favorites_main.helper({
favorites:Favorites
});
I did the following in order to clear your app of errors:
Favorites = new Meteor.Collection("favorites"); (Collection starts with a capital C)
I moved model/mainmodel.js to lib/mainmodel.js so Favorites would be available as soon as the template rendered. I always put my models under lib (or in a subdirectory) so they will be loaded first. This contradicts what I see in other places including discover meteor, so I'm unclear what the best practice is. In any case, it fixed the problem.
$ meteor add accounts-ui was needed because you referenced Accounts.ui.config.
You need to actually do a find in your favorites_main template. So it should look something like:
Template.favorites_main.helpers({
favorites: Favorites.find();
});

SqlSiteMapProvider - OnSiteMapChanged event never fires?

I'm doing the Wicked Code implementation of SqlSiteMapProvider, except in VB.NET.
There's a few things with the code that are causing issues, and I don't understand how it is supposed to work the way it's written in the article. I've provided the code straight from the article provided below. I've pasted the code here for ease of viewing
First issue - the depedency is instantiated BEFORE (lines 134-137) the tree is created (151-160) - so as soon as you add the depedency to the http.cache (165-167), the OnSiteMapChanged event (242) fires immmediately - making the entire proccess run again - and this loops many times until finally something makes it stop. (i stepped through it and counted the code looping at least 20 times before I gave up on trying to guess when it hit last)
OK, so to fix this I just moved the code to the create the dependency to AFTER the tree is built, right before inserting to http.cache (so HasChanged property is false when adding to http.cache, and you don't get stuck in this psuedo-ifinite-loop).
I still have a problem though - every time a page loads, the BuildSiteMap() hits and line 121 checks if _root is not null - it seems it is never null after it is first built... this is good because I don't want to hit the DB each time. Now, I insert a record into the table... the OnSiteMapChanged event never fires. As I browse pages on the app, the sitemap does not reflect the newly inserted record - stepping through the code, I see that the check at line 121 is still causing the function to short circuit... The sitemap will only refresh if i re-start Visual Studio, which causes the private _root field to become null again, and re-builds the sitemap, reflecting the new changes.. (refreshing the browser or starting new browser instances does not work)...
EDIT: THE ISSUE STEMMED FROM A SILLY 'SET NOCOUNT ON' LINE IN THE TOP OF MY STORED PROC. APPARENTLY THIS BREAKS THE QUERY NOTIFICATION. It seems that this statement is seen as a result set and that the second, actual query statement invalidates the result set resulting in a notification. This was very hard to find and nowhere in the MSDN documentation until I added the comment. Hope this saves someone else the miser I went through!
THE ISSUE STEMMED FROM A SILLY 'SET NOCOUNT ON' LINE IN THE TOP OF MY STORED PROC. APPARENTLY THIS BREAKS THE QUERY NOTIFICATION. It seems that this statement is seen as a result set and that the second, actual query statement invalidates the result set resulting in a notification. This was very hard to find and nowhere in the MSDN documentation until I added the comment. Hope this saves someone else the miser I went through!

"Failed to enable constraints" Error keeps cropping up (seemingly randomly) in my ASP.Net project

I have a weird problem where the "Failed to enable constraints. One or more rows contain values violating non-null, unique, or foreign-key constraints." error sometimes pops up when I am trying to build my project.
The line in question throwing the error was auto-generated code in the designer file for the dataset. To find out the offending table, I used the following code:
Try
Me.Adapter.Fill(dataTable) <--Breakpoint here on the offending line
Catch ex As Exception
For Each TRow As DataRow In dataTable.Rows
If TRow.HasErrors Then
Trace.Write(TRow.RowError)
End If
Next
End Try
Funnily enough, as soon as I run the project after putting in the above code and breakpoint, the error disappears. I assume this has something to do with the code being regenerated. All data is presented successfully, and the project compiles without errors.
However, this has happened often enough for me to frustrate me. Anybody know what might be causing the error and how I can isolate it?
What unique constraint are you placing on the datatable and have you verified that the data your passing in doesn't have any duplicates? If this is coming from a shared database perhaps someone else is modifying the data which could be causing the randomness.
Edit
If that code is exactly as what you have (And forgive me my vb.net is not as strong as my C#). Wouldn't it swallow the exception? In C# we need to rethrow the error.
Add a Trace.Write() right before you go into your for loop.
You are probably working with a typed dataset, or have some code configuration on it. Also you might be reading from one table, and then adding data from another.
In any of those cases, you really want to look into any inconsistencies between the schema. If it is a typed dataset / or configured in code, check its definition, and look for anything different from the sql table. If you are reading from 2 different tables, check the definition of both tables.
Figured it out finally!
The reason the breakpoint wasn't being hit was because the code in question was auto-generated, and had the attribute "DebuggerNonUserCodeAttribute". In addition, in my VS settings, I had set the debugger to "Just my code".
When I ran the code again, and the breakpoint wasn't hit, I noticed the breakpoint icon had changed to a warning. Hovering showed this:
"The breakpoint will currently not be hit. Breakpoints cannot be set in a method or class with the 'DebuggerNonUserCode' attribute when the debugger option 'Just My Code' is enabled."
Ouch!
Once I had removed the "Just My Code" debugging option, the breakpoint was hit, and I discovered that one of the rows had a NULL value in one of the columns which had a non-null constraint. Stupid ole' me!
You should use this code before you fill DataTable :
var dt = new System.DataTable.DataTable();
dt.Clear();
dt.Rows.Clear();
dt.Columns.Clear();

Resources