General information
Category:
Coding, syntax & commands
>I have a problem with my nested immediate if statement. The problem is if a materialid equals VX5 it is given it the value of qty2 when it should be given the number 1. It is VX50 or VX57 that have to be an exact match to receive the value of qty2. The same is true for the rest of them.
>
>Here is my statement.
>
>iif(alltrim(materialid) $ "VX29,VX39", qty3, iif(alltrim(materialid) $ "VX57,VX50", qty2, (iif(alltrim(materialid) $ "VX51",qty, (iif (alltrim(materialid) $ "CJ30,CJ31,CJ32,CJ33,CJ34,CJ35,CJ36,CJ37,CJ38,CJ39,CJ40", "2","1"))))))
>
>Can anyone help me with the correct syntax that will give me the totals that I want.
>
>Thanks in advance,
>Tyler
create a lookup table formatted as lookupQty (key c(4), qty i)
you can include it in the exe/app if you want to protect it.
write a function like:
function lookupQty(tcKey)
tcKey = alltrim(tcKey)
local array laQty[1]
select qty from lookupQty where key == tcKey into array laQty
if _tally = 0
return 0 && you might consider returning NULL in this case
else
return laQty[1]
endif
If qtX are dynamic, evaluate("qt" + transform(lookupQty))
Previous
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only