Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

adding expilcit headers


Hi All,

   I have data like this. how can i add headers for first four columns where the header is not available

   PFA

1 Solution

Accepted Solutions
MarcoWedel

Hi,

one possibility to partially rename headers could be:

QlikCommunity_Thread_148519_Pic1.JPG

tabHeaders:

LOAD * INLINE [

    Col, Header

    @1, Header1

    @2, Header2

    @3, Header3

    @4, Header4

];

tabTemp:

CrossTable(Col, Header)

LOAD 1, *

FROM [http://community.qlik.com/servlet/JiveServlet/download/695530-145115/Revised_Test.txt] (txt, codepage is 1252, no labels, delimiter is '\t', msq)

Where RecNo()=1;

Concatenate(tabHeaders)

LOAD Col, Header

Resident tabTemp

Where Len(Header);

mapHeaders:

Mapping LOAD * Resident tabHeaders;

DROP Tables tabTemp, tabHeaders;

tabInput:

LOAD *

FROM [http://community.qlik.com/servlet/JiveServlet/download/695530-145115/Revised_Test.txt] (txt, codepage is 1252, no labels, delimiter is '\t', msq)

Where RecNo()>1;

RENAME Fields using mapHeaders;

hope this helps

regards

Marco

View solution in original post

7 Replies
sushil353
Master II
Master II

Hi,

When you load table using "Table Files" then in the preview of data you can give header name ..

HTH

Sushil

giakoum
Partner - Master II
Partner - Master II

LOAD @1 as test,

     @2,

     @3,

     @4,

     @5,

     @6,

     @7,

     @8,

     @9,

     @10,

     @11,

     @12,

     @13,

     @14,

     @15,

     @16

FROM

C:\Users\G96893\Downloads\Revised_Test.txt

(txt, codepage is 1252, explicit labels, delimiter is '\t', msq);

you can name all columns as desired by using as

Not applicable
Author

Hi Sushil,

Tq for your response, but that one is manual thing to be done for every file.

  Is there any alternative way?

sushil353
Master II
Master II

Hi,

Try this code

Directory;
LOAD [2014 Outlook],
Source,
S530800,
FE400,
Jan,
Feb,
Mar,
Apr,
May,
Jun,
Jul,
Aug,
Sep,
Oct,
Nov,
Dec
FROM
[..\..\Downloads\Revised_Test.txt]
(
txt, codepage is 1252, embedded labels, delimiter is '\t', msq, filters(
Replace(1, bottom, StrCnd(null, case)),
Replace(2, bottom, StrCnd(null, not)),
Replace(2, bottom, StrCnd(null, not)),
Replace(2, bottom, StrCnd(null, not)),
Replace(2, bottom, StrCnd(null, case)),
Replace(3, bottom, StrCnd(null, case)),
Replace(4, bottom, StrCnd(null, case))
));

Anonymous
Not applicable
Author

LOAD @1 as Test1,

     @2 as Test2,

     @3 as Test3,

     @4 as Test4,

     @5 as Test45,

     @6 as Test6,

     @7 as Test7

FROM file

and in transformation tab delete first row. So that you can not give first row of data that is (jan,feb,mar)

Its one time task at the time of script writing.

MarcoWedel

Hi,

one possibility to partially rename headers could be:

QlikCommunity_Thread_148519_Pic1.JPG

tabHeaders:

LOAD * INLINE [

    Col, Header

    @1, Header1

    @2, Header2

    @3, Header3

    @4, Header4

];

tabTemp:

CrossTable(Col, Header)

LOAD 1, *

FROM [http://community.qlik.com/servlet/JiveServlet/download/695530-145115/Revised_Test.txt] (txt, codepage is 1252, no labels, delimiter is '\t', msq)

Where RecNo()=1;

Concatenate(tabHeaders)

LOAD Col, Header

Resident tabTemp

Where Len(Header);

mapHeaders:

Mapping LOAD * Resident tabHeaders;

DROP Tables tabTemp, tabHeaders;

tabInput:

LOAD *

FROM [http://community.qlik.com/servlet/JiveServlet/download/695530-145115/Revised_Test.txt] (txt, codepage is 1252, no labels, delimiter is '\t', msq)

Where RecNo()>1;

RENAME Fields using mapHeaders;

hope this helps

regards

Marco

Not applicable
Author

Excellent work Marco...tq a lot