Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
jumiprado
Creator
Creator

Change fields name from other file

Hello guys!

I have the following problem,

I have two csv files, one of them have the data and the other the name of fields, when i load the information qlikview show me this

LOAD @1,

     @2,

     @3,

     @4,

     @5,

     @6,

     @7,

     @8,

     @9,

     @10,

     @11

and i have to change each field with other file where i have the names of that fields, who can i do this rapidly?

thanks!

swuehl

stalwar1

4 Replies
prieper
Master II
Master II

an example might be helpful ...
aircode might be

Header: LOAD Header FROM Headerfile ...; // get data in structured format

Data: LOAD @1, @2 , etc FROM Datafile ...;// load the csv-table

FOR i = 0 TO NOOFROWS('Header') -1 // loop through the header-table
LET sFieldRead = '@' & i; // create a string matching with the fieldnames automatically provided in Data
LET sFieldWrite = PEEK('Header', i, 'Header'); // read the corresponding value 
RENAME FIELD $(sFieldRead) TO $(sFieldWrite);
NEXT i

Peter

MarcoWedel

MarcoWedel

please post some sample data for both of your files to demonstrate
thanks
Marco
prieper
Master II
Master II

Marco's solution is better than mine ..