Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi guys, here's my problem.
I have a table like this :
And this is my desired result :
I'm trying to solve it with crosstable function, but it's not working, I don't know why.
Anybody knows how to do that??
Many thanks in advance!!!!
Hi Marcel,
Try this script
[DS]:
LOAD * INLINE [
Field1, Attribute, Value
A, xx, 1
A, yy, 2
A, zz, 3
A, xx, 4
A, yy, 5
];
[TMP1]:
GENERIC LOAD * RESIDENT [DS];
[RESULT]:
LOAD DISTINCT Field1 RESIDENT [DS];
DROP TABLE [DS];
FOR i = 0 to NoOfTables()
TableList:
LOAD TableName($(i)) AS Tablename AUTOGENERATE 1
WHERE WildMatch(TableName($(i)), 'TMP1.*');
NEXT i
FOR i = 1 to FieldValueCount('Tablename')
LET vTable = FieldValue('Tablename', $(i));
LEFT JOIN ([RESULT]) LOAD * RESIDENT $(vTable);
DROP TABLE $(vTable);
NEXT i
drop table TableList;
HTH and let me know.
Regards,
Sokkorn
Something like that?
Go to Properties/Presentation and mark Horizontal
Hi Martin, this is not as easy as you think.
I mean the first picture is a table, and the second one is my Desired Table. I want all the rows converted into columns. And it's supposed to be the result of the crosstable function.
Do yo know how to do it?
Hi Marcel,
Try this script
[DS]:
LOAD * INLINE [
Field1, Attribute, Value
A, xx, 1
A, yy, 2
A, zz, 3
A, xx, 4
A, yy, 5
];
[TMP1]:
GENERIC LOAD * RESIDENT [DS];
[RESULT]:
LOAD DISTINCT Field1 RESIDENT [DS];
DROP TABLE [DS];
FOR i = 0 to NoOfTables()
TableList:
LOAD TableName($(i)) AS Tablename AUTOGENERATE 1
WHERE WildMatch(TableName($(i)), 'TMP1.*');
NEXT i
FOR i = 1 to FieldValueCount('Tablename')
LET vTable = FieldValue('Tablename', $(i));
LEFT JOIN ([RESULT]) LOAD * RESIDENT $(vTable);
DROP TABLE $(vTable);
NEXT i
drop table TableList;
HTH and let me know.
Regards,
Sokkorn
Hi Cheav, this is what I was looking for!!
I didn't know it was gonna be so hard. Now it works like a charm.
Many thanks!!
Regards, Marcel.