Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Bart_Breekveldt
Contributor III
Contributor III

Remove table names from fieldnames

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?

Fieldnames pre-loadingFieldnames pre-loading

Labels (2)
2 Replies
marcus_sommer

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:

How-to-Rename-Fields 

- Marcus

 

rubenmarin

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;