Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi Community.
I read a unique key from a resident temp table. I need to store it in a result table and I need to add to each key two different constants into the same field. This will obviously doubled the number of records in the result table.
Now I proceed like this...
Result:
Load
Key,
'N' as Const
Resident Temp;
Load
Key,
'V' as Const
Resident Temp;
It is no racket science and I can live with that, but I'm convinced that the result can be achieved with one simple load.
Please advice...
TL
Hi,
I think this should work
for n=1 to 2
Result:
load
Key,
if($(n)=1, 'N' ,'V') as Const
resident Temp;
next n;
Not sure if it's that much cleaner or faster to be honest
Hi,
I think this should work
for n=1 to 2
Result:
load
Key,
if($(n)=1, 'N' ,'V') as Const
resident Temp;
next n;
Not sure if it's that much cleaner or faster to be honest
Hi Pablo.
Thank you for your idea. Yes, it works and it gives correct output.
BUT...
Let's assume, that we have more then 2 constants to add to the key. And moreover, the number of constants can change dynamically...
Is there any other technique how to get desired outcome without using For-Next structure?
Please advice...
TL
Hello,
we'd need to know how are the constants stored and the logic behind assigning them to each key before coming up with a technique to apply.
Take into account you can't have 2 different expressións for the same field in the same load, so If you want to code the LOAD only once, it will have to be inside some sort of loop or use a concatenated field with concat(), concatenated ApplyMap(), etc.
Regards