I have a report that uses the Item Ledger Entry line and I need to pull some information from the Item table at the same time. I'm trying to use setrange to accomplish this but I think I'm missing something:
"Item".SETRANGE("Item Ledger Entry"."Item No.");
IF "Item".FIND('-') THEN BEGIN
rootcost := "Item"."Material Cost";
END;
Thanks in advance for any help.
Comments
If You do it in trigger - On AfterGetRecord in dataitem "Item ledger entry" then code should be:
IF "Item".GET("Item ledger entry"."Item No.") THEN
rootcost := "Item"."Material Cost"
ELSE
rootcost :=0; //probably never use - You can delete this line
There is more other solution to do this ,but this will work.
Regards
The setrange needs at least two parameters to work e.g. setrange( Onwhat, RangeValue,... )
Because you're looking up a table which the code is a primary key
the following code would be better
Hope this helps
Dynamics Nav Add-ons
http://www.simplydynamics.ie/Addons.html
Dynamics Nav Add-ons
http://www.simplydynamics.ie/Addons.html
You have your "if" the wrong way around if cost = 0 then root = cost.
should be
if cost = 0 then
root := item ledger entry
else
root := cost;
Dynamics Nav Add-ons
http://www.simplydynamics.ie/Addons.html