Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
SerSwagster
Creator
Creator

Setting format in Load Inline

Hi everyone,

I'm loading an empty table with the Load Inline because subsequently I have to concatenate other data in it.

I know that, by default, all columns loaded with the Inline method are in text format. Is there a way to set the column format (for each column), straight from the Load Inline statement, for an empty table?

This because, in my case, if I load an empty table, and then I concatenate all the fields setting the data format,  Qlik has problems recognizing some date columns (maybe because it still read it as text columns).

1 Solution

Accepted Solutions
Or
MVP
MVP

I think you might be chasing the wrong issue - my understanding is that the datatype for each column is determined at the end of the load, not when the first row is loaded. However, you could use e.g. Load Field1, Field2, Date(Field3) as Field3 INLINE [

Field1, Field2, Field3 ];

if you want to try it out. This doesn't tag the field as numeric or date, though.

Or_0-1640087982203.png

 

View solution in original post

6 Replies
Or
MVP
MVP

I think you might be chasing the wrong issue - my understanding is that the datatype for each column is determined at the end of the load, not when the first row is loaded. However, you could use e.g. Load Field1, Field2, Date(Field3) as Field3 INLINE [

Field1, Field2, Field3 ];

if you want to try it out. This doesn't tag the field as numeric or date, though.

Or_0-1640087982203.png

 

SerSwagster
Creator
Creator
Author

I have to do multiple loading and operations on data. But, I necessarily concatenate data a later time due to particular loading issues. So I need to do in this way:

Load * INLINE [

a, b, c...

]

Concatenate...

It is possibile to specify datatype in the INLINE statement? 

Or
MVP
MVP

You could try it as I suggested by explicitly loading it as date(c) as c, but I don't think this will actually help.

You could try force-tagging the field as a date, but if the values aren't actually dates, that won't help either. This would be (at any point after the field c has been loaded, doesn't matter when):

Tag c as '$date';

This is the closest thing you can do to "specifying a datatype", as far as I know.

SerSwagster
Creator
Creator
Author

I'm writing my code to explain better my situation. Maybe another solution can be achieved.

A:
LOAD * INLINE [

a, b, c, d, e

];

For each vFileName in Filelist ('hello_*.xlsx')
Concatenate(A)
LOAD
*
FROM
[$(vFileName)]
(ooxml, embedded labels, table is [Sheet 1]);
Next vFileName

A2:
LOAD aaa as a,
b,
c,
date(d,'YYYY-MM-DD hh:mm:ss') as d,
if(IsNull(e), 'yes', e) as e
Resident A;
Drop Table A;

Other operations are made on table A2 but I think this is enough to explain the situation.

Column it's a problem for me because it is not recognized as a date. I would avoid to set the datatype in the graph, so for this reason i hoped it could be done in the starting inline statement.

Or
MVP
MVP

If d isn't being recognized as a date, that's likely because it contains non-date values (or it contains nothing but null values, I suppose). Other than cleaning up the values or tagging it as a date, I have no ideas that might help.

SerSwagster
Creator
Creator
Author

Anyway, it seems that your first solution is working. Thanks a lot!