Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Not applicable

If statement variable / Load script

Hi all. I am really new to Qlik so any help or suggestions would be helpful. I am working on an incremental load script that uses SQL and I want to put in some conditional WHERE clauses in my SQL.  I found this snippet below which works great, but I want to expand on this if possible

//Use alt() function to make sure the variable always has a value (avoiding null problem)

Let vQvdCreatedTime = alt(QvdCreateTime('lib://$(vQVDCommonFolder)/E_fact_tender_current.QVD'),0);

if vQvdCreatedTime > 0 then

trace File Exists!;

//Continue....

else

trace File Does not Exist!;

end if;

I want to create a new variable using an if statement.

vWhereSqlDate =

                   if vQvdCreatedTime > 0 then

                    where date = "xxxx"

//Continue....

else

where date between "===" and "===="

end if;

Any help would be appreciated.

Thanks,

1 Reply
Not applicable

Re: If statement variable / Load script

I was able to figure out a solution.

//Use alt() function to make sure the variable always has a value (avoiding null problem)

Let vQvdCreatedTime = alt(QvdCreateTime('lib://$(vQVDCommonFolder)/E_fact_tender_current.QVD'),0);

Let VFullDate = 'WHERE f.maint_tms <'  & '$(currentRunTime)';

Let VIncDate =  'WHERE f.maint_tms >=' & '$(lastRunTime)' & ' and f.maint_tms <' & '$(currentRunTime)';

if vQvdCreatedTime > 0 then

VdateFilter = '$(VFullDate)' ;

//Continue....

else

VdateFilter = '$(VIncDate)' ;

end if;

Community Browser