Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.
thnkgreen
Contributor

Populating an empty table with data from a temp table

Hello all.  I have created an empty table using the LOAD * INLINE statement.  Now I simply want to take data from a temp table created previously and store certain values in this new empty table.  Here is my code so far:

tblTasks:

LOAD * INLINE [

    Task_Number, available

];

SELECT DISTINCT PSPLN

RESIDENT tblPull

ORDER BY PSPLN;

How do you "select into" the empty table from the the resident table?  Thanks!!!

Tags (2)
1 Solution

Accepted Solutions

Re: Populating an empty table with data from a temp table

Hi,

     For that you need to rename the field.

     Say for example you want to add data into Task_Number (As per your example)

     You should do something like below.

     Load DISTINCT PSPLN as Task_Number

     RESIDENT tblPull

     ORDER BY PSPLN;

     Also one point to not in the example you have given. You cannot use the Resident with Select Statement.

     Resident works only with load statement.

Regards,

Kaushik Solanki

5 Replies

Re: Populating an empty table with data from a temp table

Your select statement needs to be a load statement because you want to get data from a resident table. You can add the data to tblTasks with the concatenate keyword:

tblTasks:
LOAD * INLINE [
    Task_Number, available
];

CONCATENATE(tblTasks)
LOAD DISTINCT PSPLN
RESIDENT tblPull
ORDER BY PSPLN;

Note,  it only retrieves distinct values of the PSPLN field. So what will happen is that a new field PSPLN will be added to tblTasks with the distinct values that are retrieved with the select statement. This doesn't make sense to me, so it's probably not what you want. Maybe you need to explain in more detail what should happen. An example document and sample data would be helpful.


talk is cheap, supply exceeds demand
thnkgreen
Contributor

Re: Populating an empty table with data from a temp table

Thank you for the quick response Gysbert. How does QlikView know which field I want “PSPLN” to go into? Is it by the order they are listed in the code? Thanks.

Re: Populating an empty table with data from a temp table

Because the name of the field is PSPLN. You didn't give the field another name, so Qlikview has to use that name.


talk is cheap, supply exceeds demand

Re: Populating an empty table with data from a temp table

Hi,

     For that you need to rename the field.

     Say for example you want to add data into Task_Number (As per your example)

     You should do something like below.

     Load DISTINCT PSPLN as Task_Number

     RESIDENT tblPull

     ORDER BY PSPLN;

     Also one point to not in the example you have given. You cannot use the Resident with Select Statement.

     Resident works only with load statement.

Regards,

Kaushik Solanki

thnkgreen
Contributor

Re: Populating an empty table with data from a temp table

Thank you Kaushik.  This helps me understand it even better.

Community Browser