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

how can i create an empty table?

LOAD * INLINE [

];

give me a script error:

Error: File .\extdata.cpp, Line 2788

LOAD * INLINE [

]

i want to create the table first, because i'm looping though a set of data and i want to use CONCATENATE even if the table doesn't exsist;

9 Replies
CELAMBARASAN
Partner - Champion
Partner - Champion

Hi,

     You have to specify the fieldnames

     Try this

     Load * Inline

     [Field1,Field2,Field3];

Or

you can go with

LOAD

          '' as Field1,'' as Field2 AutoGenerate 0;

Celambarasan

jagan
Luminary Alumni
Luminary Alumni

Hi,

Try this

TableName:

Load * Inline

     [Field1,Field2,Field3];

Hope it helps you.

Regards,

Jagan.

amien
Specialist
Specialist
Author

This can't be done without any columns?

CELAMBARASAN
Partner - Champion
Partner - Champion

Hi,

     Its not possible to do without any columns.Can you brief about your issue why you are trying to create empty table without any column?

Celambarasan

amien
Specialist
Specialist
Author

as mentioned in the openings post .. i have the CONCATENATE load in a SUB. This SUB is called a few times.

The problem is that the first time, the table doesn't exists and concatenate will not work.

i created a check that does a countrowno on the table. If that number is 0 then i create an INLINE.

i could create an inline with 1 column that will exist in the table that is going to be concatenated. but i was wondering if it's possible to create an inline without any columns or rows.

jagan
Luminary Alumni
Luminary Alumni

Hi,

Without a single column it is not possible to create a table.  Not in Qlikview, even it is not possible in any database.

So, you can try this script

TableName:

Load * Inline

     [Field1];

Now you have a table (TableName) with Field1.  Now in SUB you can concatenate your data,

CONCATENATE(TableName)

LOAD

     *

FROM DataSource;

Finally, remove the column Field1 in the table TableName by using

Data:

LOAD

     //List all columns except Field1

RESIDENT TableName;

Hope this helps you.

Regards,

Jagan.

Not applicable

Jagan is correct but an easier way to eliminate Field1 is to use:

DROP FIELD Field1 FROM TableName;

Doing this eliminates the need to reload the data that last time.

jonathandienst
Partner - Champion III
Partner - Champion III

Hi

If the field names are the same each time you call the Sub, then you can use QVs automatic concatenation. Just make sure you give the LOAD a table name lable (that also must not change) and call the sub as many times as you need.

If you do this right, then QV will concatenate the data from all the calls into the table named in your lable.

Regards

Jonathan

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
Not applicable

Jonathan's suggestion will work fine unless that first LOAD into the table in the LOOP fails to create the table because of some scripting or data error.  I have found that creating the target table with a dummy field prior to entering the LOOP is a better practice to always know you have a table into which you can CONCATENATE and you can explicitly tell Qlikview to CONCATENATE(mytablename) in the LOOP. Then after the LOOP terminates do a DROP FIELD FROM as I noted in an earlier post.