1 Reply Latest reply: Sep 3, 2014 10:48 AM by Stefan Kunte RSS

    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

        • Re: Store multiple text files, split on a field
          Stefan Kunte

          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