Skip to content

Instantly share code, notes, and snippets.

@ralfbecher
Created September 10, 2013 12:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ralfbecher/6508496 to your computer and use it in GitHub Desktop.
Save ralfbecher/6508496 to your computer and use it in GitHub Desktop.
Unnest dynamic amount of data stored in field value using LOAD While:
// 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;
@nachoalbano
Copy link

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

@ralfbecher
Copy link
Author

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