Hello Guys,
I’m working as a technical support on AX now trying some development recipes on AX. i have prior experience on java/j2ee.
i’m following the technet article http://msdn.microsoft.com/en-us/library/gg879955.aspx however, unable to get the result when i click on button ‘Display Assets’, it’s just nothing happens.
I have tested to put in info(“welcome”); in Clicked method of button, it gives me a popup when I click the button. however, when i use following code i don’t get anything, just nothing happens.
void clicked()
{
AssetTable assetTable;
while select assetTable order by AssetId
where assetTable.InsuredValue < 1000000
&& assetTable.InsuredValue >= 800
{
info(strFmt("%1 %2", assetTable.AssetId, assetTable.Name));
}
super();
}
Any idea why it’s not working or how can i make it work??
Any response will be appreciated.
First you check whether data avaiable in your table or not for specified condition
Don’t forget to verified solution if it is resolved your issue
Hello Syed,
Thank you for the reply. I tested in SQL table and data is available for this condition. good guess, but it’s something else, any more idea??
HI ,
your code is correct , may be RLS is not allowing you to get the value. You can use/ try
assettable.recordLevelSecurity(false);
after table declaration.
thanks,
Manish
Hi,
Pls deploy the below code and test the same … that is not a major changes from your code but I guess I may help you…
void clicked()
{
AssetTable assetTable;
; // Please specify the semi colon (
while select assetTable order by AssetId asc
where assetTable.InsuredValue < 1000000
&& assetTable.InsuredValue >= 800
{
info(strFmt("%1 %2", assetTable.AssetId, assetTable.Name));
}
super();
}
Regards,
Abbas
Hi Manish,
Thanks for comment, I tried RLS to set false however, it also didn’t worked. when I put in just an info(“welcome”); in clicked method with no condition it gives a popup “welcome”. seems like it goes in infinite loop, is it?..any idea to debug and walk through this line by line?
Hi Abbas,
I tried putting ( and asc but, it didn’t work…I am not understanding what i’m missing.
If the body of the while select gets never executed, it definitely means that the query doesn’t return any data. Don’t waste your time with testing it through a form - extract it to a job and debug it there. Also, don’t depend on info() - the debugger is the right tool for debugging.
By the way, you said that you saw the data in database, but was it in the some company (DataAreaId)?
Hi Shabbir Ali,
You are referring this URL http://msdn.microsoft.com/en-us/library/gg879955.aspx
Please check you form with CEU company. I guess that company has some data for your condition.
Thanks,
Hari
Dear friend,
I tried to figure it out and found that when i put this in job it looks like the while select is not getting executing when you have form there might be some reason why datas are not coming when you check from job it should come. looks like there is no data in assettable or not selecting like company may be like CEU or may be you are checking in DAT company…