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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
handry_orozco
Partner - Contributor III
Partner - Contributor III

Rename Dinamic Fields

Hi expert   

I need to rename the fields in the following table

Tabla2:

     period.20101

     period.20102

     period.20111

     period.20112

     period.20121

     period.20122

     period.20131

     ....
     ....

Resident Table1;

Drop Table Table1;

I do not always have all the fields, it is possible that in a set I do not get the period.20101, I need to remove the word period and leave only the number

Labels (1)
2 Replies
isingh30
Specialist
Specialist

Rename like this - period.20101 as 20101

You can hide this 'period.20101' by putting // in front.


Thank you!

sasiparupudi1
Master III
Master III

You could do something like below

Set vTableName='Table1';

Set i=1;

Do

Let xx=NoOfFields('$(vTableName)');

Let FromField=FieldName($(i),'$(vTableName)');

Let ToField=Keepchar('$(FromField)','0123456789');

RENAME Field '$(FromField)' to  '$(ToField)';

Let i=$(i)+1;

Loop While $(i)<=NoOfFields('$(vTableName)');