Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I have a table of data that is populated as such:
UserID PropertyName PropertyValue
1234 FristName John
1234 LastName Smith
1234 City Omaha
1234 Street Pine
How can I structure my script so as to get a more traditional table such as below
User ID FirstName LastName City Street
1234 John Smith Omaha Pine
Hi,
You need to use Generic Load and then Combine the resultant Tables. You can follow this simple code and execute in DEBUG mode to understand more.
Temp:
LOAD * INLINE [
UserID, PropertyName, PropertyValue
1234, City, Omaha
1234, FristName, John
1234, LastName, Smith
1234, Street, Pine
];
Test:
LOAD
Distinct UserID
Resident Temp;
Test_Gen:
Generic Load *
Resident Temp;
FOR i = NoOfTables()-1 to 0 STEP -1
LET vTable=TableName($(i));
IF WildMatch('$(vTable)', 'Test_Gen.*') THEN
LEFT JOIN (Test) LOAD * RESIDENT [$(vTable)];
DROP TABLE [$(vTable)];
ENDIF
NEXT i
DROP Table Temp;
vTable=;
Exit SCRIPT;