Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Rename field name

Hi All

i try to rename a field name now is Date_Inquiry  on load script , i want to rename to Date

I try below it does not work :-

RENAME Field Date_Inquiry to vFieldNew;

Paul

1 Solution

Accepted Solutions
Not applicable
Author

Hi,

then use this

QUALIFY *;

UNQUALIFY [Ref. No];

UNQUALIFY Date;

For i = 0 to NoOfRows('Inquiry') - 1

    LET vSheet    =  peek('SheetName', $(i), 'Inquiry');

Inq:

concatenate

LOAD ////dont use * here list all field instead

sample_field1,

sample_field2,

[Date_Inquiry] as Date

FROM $(vRAWPath1)Marketing Inquiry.xlsx

(ooxml, embedded labels, table is $(vSheet));

next i

UNQUALIFY *;

drop field SheetNo;

drop field SheetName;

View solution in original post

5 Replies
Not applicable
Author

Hi

here's the script,

SAMPLE_TABLE:

LOAD

Date_Inquiry as Date, ////or whatever name you want, just replace Date

sample_field1,

sample_field2,

sample_field3

FROM

YOUR SOURCE;

Regards,

Alex

Not applicable
Author

Hi Alex ,

mine script is like below , i read all the field into qv table , and at the end i need to change the field name. any alternative , or i must field name one by one ?

QUALIFY *;

UNQUALIFY [Ref. No];

UNQUALIFY [Date_Inquiry];

For i = 0 to NoOfRows('Inquiry') - 1

    LET vSheet    =  peek('SheetName', $(i), 'Inquiry');

Inq:

concatenate

LOAD

*

FROM $(vRAWPath1)Marketing Inquiry.xlsx

(ooxml, embedded labels, table is $(vSheet));

next i

UNQUALIFY *;

drop field SheetNo;

drop field SheetName;

//RENAME Field Date_Inquiry to vFieldNew;

Not applicable
Author

Hi,

then use this

QUALIFY *;

UNQUALIFY [Ref. No];

UNQUALIFY Date;

For i = 0 to NoOfRows('Inquiry') - 1

    LET vSheet    =  peek('SheetName', $(i), 'Inquiry');

Inq:

concatenate

LOAD ////dont use * here list all field instead

sample_field1,

sample_field2,

[Date_Inquiry] as Date

FROM $(vRAWPath1)Marketing Inquiry.xlsx

(ooxml, embedded labels, table is $(vSheet));

next i

UNQUALIFY *;

drop field SheetNo;

drop field SheetName;

jagan
Luminary Alumni
Luminary Alumni


Hi,

Try like this

 

FieldMap:

MAPPING LOAD * INLINE [
OldName, NewName
Test, Data
Test1, Data1
]
;

Test:
LOAD * INLINE [
Test, Test1
1, 100
2, 200
3, 300
4, 400]
;

Rename fields using FieldMap;

Regards,

Jagan.

Not applicable
Author

Hi All

I thou QV have rename commend can rename field after table is generated. so look like i need to follow alex and jagan advise. Thank you very much.