Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Announcements
Make your voice heard! Participate in the 2020 Wisdom of Crowds® Survey. BEGIN SURVEY
Highlighted
joegrant55
New Contributor

Store txt with header row

Hi

I have created a table that stores multiple fields into a txt file.

I need to add a 'header row' above the current fields as this txt file is loaded into a system that uses the header row as an indication of what to do with the file. My delimiter is '|'.

Example:

Header1|Header2|Header3|Header4

Field1|Field2|Field3|Field4|Field5|Field6|Field7|Field8|Field9|Field10

Does anyone know how I add a header row in the script?

Thanks,

Joe

Labels (5)
12 Replies
Highlighted
MVP & Luminary
MVP & Luminary

Re: Store txt with header row

Hi,

How are you storing this table in txt file?

 

Regards,
Kaushik
If reply is satisfactory, please "Like" the post.
If reply is solution, please mark as "Correct".
Highlighted
joegrant55
New Contributor

Re: Store txt with header row

Like so:

TableExample:

LOAD

 FIELD1

 FIELD2

 FIELD3 etc.

From source

Store TableExample into TableExample.txt(txt);

 

 

 

Highlighted
joegrant55
New Contributor

Re: Store txt with header row

Apologies the store part is like so:

 

Store TableExample into TableExample.txt (txt, delimiter is '|');

Highlighted
MVP & Luminary
MVP & Luminary

Re: Store txt with header row

Hi,

You should give delimiter like below and it should work.

 

Store [TableName] into [Path]\[FileName].Txt(txt, delimiter is '|');

 

Regards,
Kaushik
If reply is satisfactory, please "Like" the post.
If reply is solution, please mark as "Correct".
Highlighted
MVP & Luminary
MVP & Luminary

Re: Store txt with header row

Hi,

When i performed the same thing, I could see the headers (Field Name) in the file.

Dont you see them?

 

Regards,
Kaushik
If reply is satisfactory, please "Like" the post.
If reply is solution, please mark as "Correct".
Highlighted
joegrant55
New Contributor

Re: Store txt with header row

Hi

Yes I see them but as per my example I need another row above the field name headers made up of different names.

Header1|Header2|Header3|Header4

FieldName1|FieldName2|FieldName3|FieldName4|FieldName5|FieldName6|FieldName7

I have attached a txt document example also.

Thanks,

Joe

Highlighted
MVP & Luminary
MVP & Luminary

Re: Store txt with header row

What is the source of the table?

Is it Excel or database table?

 

Regards,
Kaushik
If reply is satisfactory, please "Like" the post.
If reply is solution, please mark as "Correct".
Highlighted
joegrant55
New Contributor

Re: Store txt with header row

It has been created using multiple qvds and xlsx and then stored as a csv.

This csv. is then loaded, edited and saved as a txt file.

Highlighted
MVP & Luminary
MVP & Luminary

Re: Store txt with header row

You can do one thing.

Store that data in a temporary text file, similar to what you are doing currently.

Store [TableName] into [Path]\[FileName].Txt(txt, delimiter is '|');

Now write the load script to load this txt file (Newly created one in above step).

Your load statement should look like below.

Data:
LOAD @1 as Header1,
@2 as Header2,
@3 as Header3,
@4 as Header4

FROM
Path\Filename
(txt, codepage is 1252, no labels, delimiter is '|', msq);

And store this using normal Store command.

 

Regards,
Kaushik
If reply is satisfactory, please "Like" the post.
If reply is solution, please mark as "Correct".