Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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
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
In your second RenameMappingTable are spaces between the old_name and the comma-delimiter - I think this will be the reason.
- Marcus
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;
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
];