Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
5abi0001
Creator
Creator

Dynamic Names of Columns

Hi! 🙂

I have a question .. i have a table with about 15 columns with specific column names.

What i want is, that trough a lookup (an excel or something else) i want to set the names of the columns in QlikView, for example:

 

In the table with 15 columns there is a name like: LoadDate ..

In the other table (Lookup) i make a matching -> when the columname is LoadDate, i want to set the column name in QlikView Loading Date.

In the script i load both tables .. but now i dont know how i can set the name as in the lookup table, when i make for example a table and set LoadDate as a Dimension.

How is it possible to make this?

I hope you can understand what i want 😄

 

 

1 Solution

Accepted Solutions
jaibau1993
Partner - Creator III
Partner - Creator III

When you load your lookup table you have to insert the prefix "Mapping" before the LOAD statement:

DetailsTable:
LOAD Stand,
LoadDate,

Columnname,

StorageName
FROM
[..\QvdGenerator\qvd\Details.qvd]
(qvd);

MatchingName:
Mapping LOAD rootName ,
QvName 
FROM
[..\QvdGenerator\qvd\MatchingNameqvd]
(qvd);


RENAME Fields using MatchingName;

Jaime.

View solution in original post

7 Replies
jaibau1993
Partner - Creator III
Partner - Creator III

Hi! Please, try something like the following in your script:

//Your data table
LOAD * Inline [
Column1, Col2, Column3, Col4
];

//Your "LookUp" table
MAP_ColNames:
Mapping LOAD * Inline [
PreviousName, NewName
Column1, NewColumn1
Col2, NewColumn2
Col4, NewColumn3
];

//Rename
RENAME Fields using MAP_ColNames;

Hope it helps!

Bests,

Jaime.

5abi0001
Creator
Creator
Author

Hi, thank you for your response.

In my Lookup table i have to columns .. rootName and QvName .. than i have values where i already do the matching.

 

Now when i do the rename it says; Table not found error .. but i have this table.

jaibau1993
Partner - Creator III
Partner - Creator III

Hi! I think I'll need a sample of your code or a sample file because you may have an error in your script. If you try the code I posted above in a separate file you'll see that it works so I suspect you made a mistake when embbeding it into your script.

Jaime.
5abi0001
Creator
Creator
Author

DetailsTable:
LOAD Stand,
LoadDate,

Columnname,

StorageName
FROM
[..\QvdGenerator\qvd\Details.qvd]
(qvd);

MatchingName:
LOAD rootName ,
QvName 
FROM
[..\QvdGenerator\qvd\MatchingNameqvd]
(qvd);


RENAME Fields using MatchingName;

jaibau1993
Partner - Creator III
Partner - Creator III

When you load your lookup table you have to insert the prefix "Mapping" before the LOAD statement:

DetailsTable:
LOAD Stand,
LoadDate,

Columnname,

StorageName
FROM
[..\QvdGenerator\qvd\Details.qvd]
(qvd);

MatchingName:
Mapping LOAD rootName ,
QvName 
FROM
[..\QvdGenerator\qvd\MatchingNameqvd]
(qvd);


RENAME Fields using MatchingName;

Jaime.

5abi0001
Creator
Creator
Author

Thank you! It works! 🙂

jaibau1993
Partner - Creator III
Partner - Creator III

You are welcome! 🙂