Unable to get the values of (AvailOrdered) field in InventTable

Task:

I have been given the task to add a field AvailOrdered (InventSum) in the InventTable .

For which i wrote the method in InventTable as :

display amountmst AvailOrdered()

{

itemid itemid;

inventdimid inventdimid;

;

return inventsum::find(inventtable.ItemId,inventdimid).AvailOrdered;

I still am not able to get the required values from the field (availordered) .

}

Try to explain to me in your own words what you think that your method does. That might help you to understand why it’s wrong.

Also, you forgot to tell us that you’ve written your method on the form, not on the table. Don’t forget it next time. (I see it in this case because your code wouldn’t compile on table).

And you haven’t mentioned your version of AX. Please don’t forget this either.

The version is dynamics ax 2009

My method selects the field availorders from inventsum and return it into inventtable (form).

The code is written on Inventtable (table) and not on form.

No, you must be wrong. The method wouldn’t compile on table, because inventTable variable isn’t declared anywhere in your method and there can’t be any member variable. Do you understand the different between table and form datasource?

Your method finds InventSum based on the currently active ItemId (which is always the same) and empty InventDimId. Because InventDimId is mandatory in InventSum, it can’t ever find anything.

You would find it all by yourself if you used the debugger. Please save time of both of us and learn how to debug your code.

I am sorry for asking this question , i shouldn’t have given up on this task so easily.

Though i was still not able to get the desired code but i would really appreciate for your moral support

Thanks a lot

I am running out of clues Martin. Kindly help me with this please.

Sorry, I still can’t read thoughts. What’s your current problem?

How can i add the field PhysicalInvent into inventtable form .

Alittle correction in your code.

display amountmst AvailOrdered()

{

inventdimid inventdimid;

;

return inventsum::find( this.ItemId, inventdimid).AvailOrdered;

}

if you manage to get the value of inventdimid then you should get the AvailOrdered value.

I think you are not able to get the inventdimid thus you are getting an empty result or no results for that matter.

No , the field shows 0.00 value through this code.

This is not working