Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Store into text file with filters

Hi!

I need to store some fields from a table into a text file. Do anybody know if it's possible to use filters in the store into statement? I tried this, no error in script but the outcome was not the expected. It was suppose to keep the cells i column 3 (field 3) that contained % and delete the ones that started with 0.



store

field1, field2, field3 from table1 into file.trn
(txt, delimiter is '|', embedded labels, filters(
Remove(Row, RowCnd(CellValue, 3, StrCnd(end, '%', not))),
Remove(Row, RowCnd(CellValue, 3, StrCnd(start, '0')))));

I use version 9.0.7320.7 SR2, can an upgrade solve the problem?

Thanx!

/Kristofer

1 Solution

Accepted Solutions
Not applicable
Author

Hi!

I found this makro by Nimish Shah useful. That solved my problems.

/Kristofer

View solution in original post

8 Replies
Miguel_Angel_Baeyens

Hello Kristofer,

You can work around that by creating a new table with the proper field formats, store it and drop it avoiding unneeded syn tables.

ToStoreTemp:LOAD field1, field2, field3 RESIDENT Table WHERE Left(field3, 1) <> 0 AND Index(field3, '%') > 0; STORE ToStoreTemp INTO File.txt (txt); DROP TABLE ToStoreTemp:


Regards.

Not applicable
Author

Hi!

Thanx for your answer.

That's the work around I use in my script now, but if you could use filters in the store into statement you probebly save some loading time if you got large tables.

/Kristofer

Not applicable
Author

Hi!

Another thought could u store files (qvd/txt) without lables?

Exemple:

Field1 | Field 2
1 | a
2 | b
3 | c

Becomes:

1 | a
2 | b
3 | c

/Kristofer

ManuelRühl
Partner - Specialist
Partner - Specialist

this is what i need too!

store into txt without field names.

Manuel Rühl
www.mamaconsulting.de
Not applicable
Author

Try a batch file that strips the header. Like this:


type data.txt | find /V "Field1|Field2" > noheader.txt


-Alex

Miguel_Angel_Baeyens

I'd try this way too, meaning something external to QlikView, since QVD/TXT QlikView stored files use the field names to allow further retrieving of data (as any other database does), and it wouldn't make any sense without them.

Regards.

Not applicable
Author

Hi!

I found this makro by Nimish Shah useful. That solved my problems.

/Kristofer

Not applicable
Author

119 lines of Macro + have Excel installed

versus

one line batch file that does the same

Smile