Created
September 10, 2013 12:10
-
-
Save ralfbecher/6508496 to your computer and use it in GitHub Desktop.
Unnest dynamic amount of data stored in field value using LOAD While:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// unnest data of field value: | |
Input: | |
LOAD * INLINE [ | |
ACCOUNT, SUPPLIES | |
001, "Apples,Bananas,Tomatos" | |
002, "Bread,Butter,Cheese" | |
003, "Pretzel,Wuerstl" | |
]; | |
Result: | |
LOAD ACCOUNT, subfield(SUPPLIES, ',', IterNo()) as SUPPLY | |
Resident Input | |
While IterNo()<=SubStringCount(SUPPLIES, ',')+1; |
Yes, you're right. This was oversimplified. Actually, cannot remember why I needed a While loop, probably to calculate something else in combination with SubField, e.g having a counter or else..
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi Ralph,
First of all thanks for sharing all your code snippets. Regarding this one, wouldn't it be easier to do this for the Result table? Am I missing something?
Result:
LOAD ACCOUNT,
SUPPLIES,
subfield(SUPPLIES, ',') as SUPPLY
Resident Input;
Thanks,
Regards,
Ignacio