Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi there,
Could i show table data below in such format?
original table :
Date | Accident | details 1 | Accident 2 | details | Accident 3 | details | Accident 4 | details |
07/05/2020 | Acc 1 | Det1 | Acc2 | det2 | Acc3 | det3 | Acc4 | det4 |
I would like to show it as:
Acc 1 | Det1 |
Acc2 | det2 |
Acc3 | det3 |
Acc4 | det4 |
I am exploring text boxes & concatenating , and also open to suggestions.
Can anyone assist?
Thanks a million!
Jose
In your case you want to tidy your data (Hadley Wickham Tidy Data <- good read) from a long table.
Assuming your data has more variables, first in script editor give it a proper naming in a temporary table, followed by concatenation in a final table.
Example:
[TmpTable]:
LOAD
RecNo() As IndexKey, //Maybe useful since each row in the long table will have a unique key
"Date",
Accident As Accident1,
"details 1" As Details1,
"Accident 2",
details As Details2,
"Accident 3",
details1 As Details3,
"Accident 4",
details2 As Details4
FROM DataSource;
Tidy the TmpTable
[Final]:
Load
Date,
Accident1 As Accident,
Details1 As Details
Resident TmpTable;
Concatenate(Final) //not explicitely necessary since Qlik will concatenate by names automatically, but to know what is going on
Load
Date,
"Accident 2" As Accident,
Details2 As Details
Resident TmpTable;
//Follow the other columns in same format.
Drop Table TmpTable;