Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Not applicable

Data Loader If Statement


I am trying to load data from an access data table where I want to check two date fields (dteMultipleYearEndDate and Contract_End_To). If the dteMultipleYearEndDate isnull then I want to load the Contract_End_To date instead as EndDate

I am trying to do this in the data loader as I want to then use a derive on the EndDate to give me date time fields in Qliksense Desktop.

I have tried this code but receive a script error:

if 'dteMultipleYearEndDate' isnull then Load [Contract Date to] as [EndDate] from `TblProviderInformation Query9`; else Load [dteMultipleYearsEndDate] as [EndDate] from `TblProviderInformation Query9`; endif

I have also tried:

if 'dteMultipleYearEndDate' isnull then Load [Contract Date to] as [EndDate] from `TblProviderInformation Query9` else Load [dteMultipleYearsEndDate] as [EndDate] from `TblProviderInformation Query9` endif

I can not seem to find any information to indicate if an IF statement can even be used in the data loader. Qliksense provides expresison guidance on the if statement but I am not sure if that means it can be used in the data loader or is just standard guidance you would receive in a expression builder for functions / master items.

Help would be greatly appreciated.



3 Replies

Re: Data Loader If Statement

You can use:

     =Alt(dteMultipleYearEndDate, Contract_End_To)

Alt is like the SQL COALSESCE or ISNULL commands, except that it returns the first valid numeric. Dates are numerics, but nulls are not.


Re: Data Loader If Statement


Honored Contributor III

Re: Data Loader If Statement


if (isnull(dteMultipleYearEndDate) ,[Contract Date to],dteMultipleYearEndDate) as [EndDate]