4 Replies Latest reply: Feb 16, 2017 2:55 PM by Eric Flottmann RSS

    Create Table Loop Question

    Eric Flottmann

      This seems like it should be simple but its not acting as expected.  I am trying to loop through what is essentially a generic table looking for certain name/value pairs.  I would like to create a table for each name in my list with the value and identifier from the source data. I am aware of the Generic Load but want to performance test this strategy against it.  Here is my code:

       

      //This is my list of names from the source table.

      UniqueAffiliateDataNames:

      LOAD * INLINE [

        DataNames

        'IPAddress'

        'ListID',

        'SubID',

        'RepID',

        'CampaignId',

        'SubCampaignId',

        'UniqueId',

        'StudentId'

      ];

       

      // date is simply to keep the table lean

      LET vStartDate = DATE('2017-02-01', 'YYYY-MM-DD hh:mm:ss');

       

       

      FOR EACH vDataName IN FieldValueList('DataNames')

        [$(vDataName)]:

        LOAD LeadId, Value

          FROM [$(vFilePath)LeadSharedData.qvd] (qvd)

          WHERE Name = '$(vDataName)'

          AND Category = 'F'

              AND DateEntered > '$(vStartDate)';

      NEXT vDataName

       

       

      DROP TABLE UniqueAffiliateDataNames;

       

      When I run this script in the debugger I see the names populate in the Table name and in the Where clause as expected.  However, when the job finishes, I only seem to get one table (with the first value from the list).

       

      I feel like I am missing something simple here.