Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi
Picture this load script:
Items:
Load
ItemNo,
Qty,
if(ItemType=1,Price1, if(ItemType=2,Price2,if(ItemType3=3,Price3))) as Price,
...
This will work, but if there would be 20 different pricefields, it would make a looong nested if, which I would like to avoid. Ok, it's silly example, but still...
This is what I would like to do instead:
map_Pricefield:
Mapping Load * inline
[PriceType, Fieldname
1,Price1
2,Price2
3,Price3
...
];
Items:
Load
ItemNo,
Qty,
ApplyMap('map_Pricefield',ItemType) as Price,
...
But it will most likely not work, since the ApplyMap function do not return a "field" (as far as I know), it returns a "value", so what I would get in my new "Price field", is only the text "Price1" etc, and not value of the the fieldname [Price1].
So my question is:
Is it possible to replace a complex nested if where the result of he nested if's are fieldname(s) and not values?
brg Robert Svebeck
Hi Robert,
try this.
C u,
Stefano.
Excellent Stefano! Perfect - just what I requested! Thanks!
/Robert
Hi Robert,
1 thing, i put this example without control.
Be careful with the order of field in the concat.
Pick function take field in that order.
Tell me if u have some dubt.
Stefano.