Hi Everybody,
I'm wondering why the following code doesn't work the way I want it to. I wanted it to figure out if the variable called OLStaging.ITEM_CODE is a Resource or an Item, but only if it's unblocked. And, I want it to run the ErrorAdd function whenever there's the item/resource doesn't exist, or if it exists but it's blocked.
Currently, if the Resource doesn't exist, then it doesn't run "ELSE IF Item.GET(OLStaging.ITEM_CODE) = TRUE THEN".
Thanks in advance for your help.
VAR
OLStaging@1000000000 : Record 50040;
Item@1000000004 : Record 27;
Resource@1000000011 : Record 156;
ItemType@1000000014 : Text[30];
IF Resource.GET(OLStaging.ITEM_CODE) = TRUE THEN
IF Resource.Blocked = FALSE THEN
ItemType := 'Resource'
ELSE IF Item.GET(OLStaging.ITEM_CODE) = TRUE THEN
IF Item.Blocked = FALSE THEN
ItemType := 'Item'
ELSE
ErrorAdd('Item/Resource is blocked/doesn''t exist.');
Comments
Microsoft Dynamics NAV User
Your first code, indented as the compiler should interpret it :
and the corrected version :
Microsoft Dynamics NAV User