Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I have this table with no headers:
a 1
b 2
c 3
d 4
I want it to look like this where a,b,c,d are now headers:
a b c d
1 2 3 4
I think I should use Crosstable, but so far no joy.
Refer to this example :
tmpData:
Crosstable (Designation, Values)
Load * inline [
City, L1, L2, L3, L4, L5, L6
Mumbai, 1, 0, 0, 1, 1, 0
Bangalore, 0, 0, 1, 1, 1, 0
Delhi, 1, 1, 0, 0, 0, 0
Pune, 1, 0, 0, 1, 1, 1
];
Generic
Final:
Load
Designation,
City as City2,
Values
Resident tmpData;
GenericTableJoin:
Load Distinct Designation Resident tmpData;
Drop Table tmpData;
FOR i = NoOfTables()-1 to 0 STEP -1;
LET vTable=TableName($(i));
IF WildMatch('$(vTable)','Final.*') THEN
LEFT JOIN ([GenericTableJoin]) LOAD * RESIDENT [$(vTable)];
DROP TABLE [$(vTable)];
ENDIF
NEXT i
Exit Script;
Refer to this example :
tmpData:
Crosstable (Designation, Values)
Load * inline [
City, L1, L2, L3, L4, L5, L6
Mumbai, 1, 0, 0, 1, 1, 0
Bangalore, 0, 0, 1, 1, 1, 0
Delhi, 1, 1, 0, 0, 0, 0
Pune, 1, 0, 0, 1, 1, 1
];
Generic
Final:
Load
Designation,
City as City2,
Values
Resident tmpData;
GenericTableJoin:
Load Distinct Designation Resident tmpData;
Drop Table tmpData;
FOR i = NoOfTables()-1 to 0 STEP -1;
LET vTable=TableName($(i));
IF WildMatch('$(vTable)','Final.*') THEN
LEFT JOIN ([GenericTableJoin]) LOAD * RESIDENT [$(vTable)];
DROP TABLE [$(vTable)];
ENDIF
NEXT i
Exit Script;