Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
livio218526
Creator
Creator

Upper Column Header Name

Hi everyone,

i have a problem. I'd like to convert Column Header Name to Upper.

I use a loop to read all excel files.

 

 

FOR each File in filelist('lib://Input/'& '\*.xlsx')

TABLE1:
LOAD
	*
FROM [$(File)] (ooxml, embedded labels, table is Sheet1);

TABLE2:
LOAD
	*
FROM [$(File)] (ooxml, embedded labels, table is Sheet2);

NEXT File

 

How I can convert all the column header name of all files to Upper case??

 

 

Thanks,

Livio

Labels (3)
1 Solution

Accepted Solutions
asinha1991
Creator III
Creator III

 

easiest way i can think of

For f = 1 to NoOfFields('ur table')

let oldName=   FieldName($(f),'ur table');

let newName= upper( FieldName($(f),'ur table'));

Rename Field $(oldName) to $(newName);  

Next f

 

View solution in original post

5 Replies
asinha1991
Creator III
Creator III

 

easiest way i can think of

For f = 1 to NoOfFields('ur table')

let oldName=   FieldName($(f),'ur table');

let newName= upper( FieldName($(f),'ur table'));

Rename Field $(oldName) to $(newName);  

Next f

 

livio218526
Creator
Creator
Author

What is 'ur table'? The name of the Table?  --> TABLE1 andTABLE2 in my code ...

asinha1991
Creator III
Creator III

yes

livio218526
Creator
Creator
Author

Ok, there are any problems with ' ' (blank space), but it's correct! 

paoloderegibus
Partner - Contributor III
Partner - Contributor III

You can try something like:

for each table in 'TABLE', 'TABLE_2'
  FOR i = 1 to NoOfFields('$(table)')
      LET field = FieldName($(i), '$(table)');
      LET newField=upper('$(field)');
      TRACE '$(field) to $(newField)';
      RENAME Field $(field) to $(newField);
  next
next