Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Multiple possible column names for same field?

Greetings,

I have a QVD Generator, which pulls from an excel file that is uploaded periodically. However, some of the columns may be named slightly differently sometimes. So for example, the column name could be "First Column" in some instances or sometimes it could be "First_Column". In either case only one of these columns should exist in the Excel file at any point in time, albeit under a slightly different name. So I want [First Column] or [First_Column] as [First Column]. Please let me know if this is possible.

Thanks in Advance!

4 Replies
sunny_talwar

Here is a way to dynamically load all the field names

Peter_Cammaert
Partner - Champion III
Partner - Champion III

You can try with the ALIAS statement. It allows you to define an automatic rename for fields with slightly deviating field names before you load them. For example,

ALIAS [First_Column] as [First Column];

will force an implicit rename in each subsequent LOAD or SELECT. Of course, the script will not automatically detect other new variations on the same field name. Artificial Intelligence is not (yet) built into the script engine .

So whenever you detect a new naming deviation, you 'll have to add it to the corresponding ALIAS statement. If you put all ALIASes in an external script and include that one in every load script, management of field naming becomes very straightforward.

Peter

sunny_talwar

I did not know about ALIAS. Thanks for introducing that Peter

Peter_Cammaert
Partner - Champion III
Partner - Champion III

My pleasure.