Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi Team,
I am trying to rename columns of a table using Mapping function.
I have provided the link for your reference.
Also, I am attaching my QVW and excel file.
Renaming fields in QlikView using Mapping Load | Learn QlikView
Please help me out in solving the same.
I have tried allot but could not find solution for the same
Regards
Priyanka Pandey
Hi Priyanka,
The mapping load should be first in order, secondly in your excel with the mapping remove the [ and ] characters.
Script:
Map_Table:
Mapping LOAD Data_Field_Name,
Display_Field_Name
FROM
[Mapping Names.xls]
(biff, embedded labels, table is Sheet1$);
Rename Fields Using Map_Table;
FieldNameMap:
LOAD [Row ID],
[Order ID],
[Order Date],
[Ship Date],
[Ship Mode],
[Customer ID],
[Customer Name],
Segment,
Country,
City,
State,
[Postal Code],
Region,
[Product ID],
Category,
[Sub-Category],
[Product Name],
Sales,
Quantity,
Discount,
Profit
FROM
[Sample - Superstore.xls]
(biff, embedded labels, table is Orders$);
Hi Priyanka,
The mapping load should be first in order, secondly in your excel with the mapping remove the [ and ] characters.
Script:
Map_Table:
Mapping LOAD Data_Field_Name,
Display_Field_Name
FROM
[Mapping Names.xls]
(biff, embedded labels, table is Sheet1$);
Rename Fields Using Map_Table;
FieldNameMap:
LOAD [Row ID],
[Order ID],
[Order Date],
[Ship Date],
[Ship Mode],
[Customer ID],
[Customer Name],
Segment,
Country,
City,
State,
[Postal Code],
Region,
[Product ID],
Category,
[Sub-Category],
[Product Name],
Sales,
Quantity,
Discount,
Profit
FROM
[Sample - Superstore.xls]
(biff, embedded labels, table is Orders$);
Use Rename Field Function.
First you have to load your mapping table:
Map_Table:
Mapping LOAD Data_Field_Name,
Display_Field_Name
FROM
[Mapping Names.xls]
(biff, embedded labels, table is Sheet1$);
Rename Fields Using Map_Table;
After this, you can load the table you want to rename fields and you will see the change in fields names.
Hi,
Thank you for your instant reply.
I tried working on your solution but i am facing the same issue.
Below is the script for your reference
Map_Table:
Mapping LOAD Data_Field_Name,
Display_Field_Name
FROM
[Mapping Names.xls]
(biff, embedded labels, table is Sheet1$);
Rename Fields Using Map_Table;
FieldNameMap:
LOAD [Row ID],
[Order ID],
[Order Date],
[Ship Date],
[Ship Mode],
[Customer ID],
[Customer Name],
Segment,
Country,
City,
State,
[Postal Code],
Region,
[Product ID],
Category,
[Sub-Category],
[Product Name],
Sales,
Quantity,
Discount,
Profit
FROM
[..\Sample Store.xlsx]
(ooxml, embedded labels, table is Orders);
Regards
Priyanka
Have you also replaced the square brackets in the excel file [ and ] ?? Pleas use attached excel file and it should work. Also attached a working example qvw file with sample data (did not have your data file)
Hi,
Thank you for your help.
Your solution really helped me. After removing square brackets([]) the script executed successfully.
Once again Thank you
Regards
Priyanka
Hi,
Thank you for your reply.
Regards
Priyanka
You're welcome