Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
irmantas
Contributor III
Contributor III

Load scripting from SQL

Hello,

Is it possible, in loading data from SQL, add new field using IF condition.

Ex: IF(DataTo<Today(),'True','False') as NewField

Labels (1)
1 Solution

Accepted Solutions
Kushal_Chawda

Yes. using preceding load you can do that

 

LOAD *,

            if(ToDate <today(),'True','False') as Flag;

SQL Select ID,FromDate,ToDate

FROM db.tablename;

View solution in original post

5 Replies
martinpohl
Partner - Master
Partner - Master

how should this work?

You are loading a number of lines.

In one Date<today(), in the next line maybe not.

You can't delete a field in a table for a single line (or a number of lines).

You can load all datas < today and next = today() in two diffenrent tables

irmantas
Contributor III
Contributor III
Author

I want to load all data from table. I just want add new field in line, with some information about one of fields from this line.

If ToDate<Today(), True,False

For ex (Today 01/20/2020):

Id     FromDate       ToDate                    NewField

1       01/01/2020     01/19/2020          'True'

2       01/01/2020      01/25/2020         'False'

 

Kushal_Chawda

Yes. using preceding load you can do that

 

LOAD *,

            if(ToDate <today(),'True','False') as Flag;

SQL Select ID,FromDate,ToDate

FROM db.tablename;

martinpohl
Partner - Master
Partner - Master

so you give the code by yourself in the first post....

irmantas
Contributor III
Contributor III
Author

Thank you. Its works.