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: 
ImRakeshBanik
Contributor
Contributor

I wanted to change the column names from 3age to 3AGE( in upper case)

Hi Team,

 

I cant rename by columns to Upper case where the column headers start with a number.

For e.g., 3age to 3AGE.

 

I tried to use Text in the script, but it  didnt help. demo code.

Test:

load * inline[

id,Name, 3Age

1,Romeo, 23

2, Juliet, 21

];

 

let vTotal=NoOfFields(Test');

 

For vCount=1 to $(vTotal)

   Let vName=text(FieldName($(vCount),'Test'));

   trace $(vName);

  Let vName1=text(Upper(FieldName($(vCount),'Test')));

   trace $(vName1);

   Rename field $(vName) to $(vName1);

Next;

 

 

It gives below error :-

Syntax error

Unexpected token:'3', expected one of: 'using','IDENTIFIER','LITERAL_STRING','LITERAL_FIELD'

Rename Field >>>>>>3<<<<<<Age to 3AGE

Labels (1)
1 Solution

Accepted Solutions
marcus_sommer

Your field-names contain a special char and must be therefore wrapped, for example in this way:

 Rename field [$(vName)] to [$(vName1)];

- Marcus

 

View solution in original post

4 Replies
Bill_Britt
Former Employee
Former Employee

Hi,

 

Have you tried

 

RENAME FIELD OldFieldName TO NewFieldName;

 

RENAME FIELDS OldName1 TO NewName1, OldName2 TO NewName2, OldName3 TO NewName3;

 

Bill

Bill - Principal Technical Support Engineer at Qlik
To help users find verified answers, please don't forget to use the "Accept as Solution" button on any posts that helped you resolve your problem or question.
marcus_sommer

Your field-names contain a special char and must be therefore wrapped, for example in this way:

 Rename field [$(vName)] to [$(vName1)];

- Marcus

 

ImRakeshBanik
Contributor
Contributor
Author

Hi @Bill_Britt, I tried that but it didnt help.

ImRakeshBanik
Contributor
Contributor
Author

Hi @marcus_sommer,

Thanks! It worked.

The wrapping thing for columns is great. I almost forgot that.