Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Rename fields using mapping table

Hi All,

I have some problem with command rename fields which the scenario is we have 2 table : Product and Order.

By field id in table product should be link with field product in order.    However, it seem that command rename fields using <mapping table> cannot change field name if they already exist.      Do you have any idea on this ?   

Thanks for all response.

Code

product:

LOAD * INLINE [

    id, description, category, type

    10001, Product A, category A, A

];

Rename_Table1:

Mapping

LOAD * INLINE [

    old_name , new_name

    id , product_id

    description , product_desc

    category , product_category

    type , product_type

];

RENAME Fields using Rename_Table1;

order:

LOAD * INLINE [

    id, product, amount

    A0001, 10001, 40000

];

Rename_Table2:

Mapping

LOAD * INLINE [

    old_name , new_name

  id , order_id

  product , product_id

];

RENAME Fields using Rename_Table2;

Result

2015-02-24_09-45-47.jpg

4 Replies
hectorgarcia
Partner - Creator III
Partner - Creator III

I sugest you to create a loop

load the file

use rename fields using 'mapname'

store the file to a qvd

drop the table

and next file

marcus_sommer

In your second RenameMappingTable are spaces between the old_name and the comma-delimiter - I think this will be the reason.

- Marcus

buzzy996
Master II
Master II

try this way,

order:

LOAD * INLINE [

    id,product,amount

    A0001,10001,40000

];

Rename_Table2:

LOAD * INLINE [

old_name,new_name

id,order_id

product,product_id

];

FieldMap:

Mapping load old_name, new_name resident Rename_Table2;

Rename fields using FieldMap;

maxgro
MVP
MVP

I think it doesn't work because you already have in Rename_Table1 a rename to product_id

id , product_id



change in (bold) ad it works


Rename_Table2:

LOAD * INLINE [

old_name,new_name

id,order_id

product,product_id_2

];