Skip to Content
author's profile photo Former Member
Former Member

Template Table

Is it possible to create template tables within a while loop?

I have a need to create staging tables for all customers of a particular Accounting group type. I'm not sure how the naming of the template tables would be set dynamically?

Any assistance and direction is greatly appreciated.

Thank you!

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • Best Answer
    Posted on Jun 25, 2016 at 05:04 PM

    Hi Jamie,

    I guess we can implement this. But you need to have target tables created in DB with your desired name.

    Take a script at the end after the dataflow in the while loop and write sql() function to insert data from temp table created to your Target table.

    And write if condition based on the while loop condition you defined.

    If suppose you while condition is like this ($G_WHL_COND<=4) and you declared this variable as 1 initially and the value of this will be incremented for every loop.

    Now write end script like this for the 1st loop

    if($G_WHL_COND=1)

    begin

    sql('Data_store_name','select * into <tablename> from <temp_table>);

    end

    for the 2nd loop

    if($G_WHL_COND=2)

    begin

    begin

    sql('Data_store_name','select * into <tablename> from <temp_table>);

    end

    If you want to create 4 tables write if conditions 4 times and for each if condition "From table will be your temp table created in DF" and "into table should be your expected target table name"

    Make sure you increment $G_WHL_COND in this script after all the if conditions.

    Thanks,

    Ravi kiran

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.