Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Dear community,
Fieldnames have tablenames included before loading in the Qlik Sense script. I use Unqualify, instead of qualify, but still table_names appear in front of every field. This is the only table I loaded, so the field names are not generated to differentiate them. How to solve this without doing this manually?
You need to rename your fields - this could be done directly/manually within the load or before the load by creating appropriate ALIAS or after the load with a mapping. More to it could you find here:
- Marcus
Hi, maybe table names can be more dynamic but here is a way of doing it:
// Load original table
OriginalTable:
LOAD * Inline [
ORD_ORDERS_PK, ORD_ORDERS_ORDNUM
1,1
2,2
];
// Set length of table name
LET CharsToSkip = Len('ORD_ORDERS_')+1;
// Create temporary table with relations between old names and new names
For i=0 to NoOfFields('OriginalTable')
tmpFields:
LOAD FieldName as OldName, Mid(FieldName, $(CharsToSkip)) as NewName;
LOAD FieldName($(i), 'OriginalTable') as FieldName
AutoGenerate 1;
Next
// Create map to rename fields
mapFieldNames:
Mapping LOAD OldName, NewName Resident tmpFields;
DROP Table tmpFields;
// Rename fields
RENAME Fields using mapFieldNames;