Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Store multiple text files, split on a field

Good morning,

I am trying to use the store statement to dump a table after a script, but have it product multiple text files based on a field.

For example:

Output:

Load

CustomerNumber,

SalesAmt,

COGS,

SalesPerson,

City,

State

Resident Temp1;

Store Output into [\David\documents\text1.txt] (txt);

How can i get this script to make an individual text file for each Salesperson?

-David

1 Reply
Anonymous
Not applicable
Author

hi david,

this should work:

Salespersontable:

load distinct

SalesPerson

Resident Temp1;

for i = 0 to noofrows('Salespersontable')

let vSP = peek ('SalesPerson', $(i), 'Salespersontable');

   

Output:

Load

CustomerNumber,

SalesAmt,

COGS,

SalesPerson,

City,

State

Resident Temp1 where match(SalesPerson, '$(vSP)');

Store Output into [\David\documents\text$(vSP).txt] (txt);

drop table Output;

next

Regards,

Stefan