Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.


Breathe easy -- you now have more time to plan your next steps with Qlik!
QlikView 11.2 Extended Support is now valid through December 31, 2020. Click here for more information.

Not applicable

Scripting Help


if(len([FHA Trial Date])<>0,
if(day([FHA Trial Date])<=20,date(monthstart(addmonths([FHA Trial Date],2))),date(monthstart(addmonths([FHA Trial Date],3))))),
if([LM Workout Status Act]='IN TRIAL',[FHA Trial Date],

If(len(trim([K04 Date]))<>0,
if(len([FHA Trial Date])=0,
if(day([K04 Date])<=15,date(monthstart(addmonths([K04 Date],1))),date(monthstart(addmonths([K04 Date],2))))),
if([LM Workout Status Act]='IN TRIAL',[K04 Date],


)))))))) as [trial1_due_dt] ,



The above code says if FHA Trial Date not null then


            If day of FHA Trial Date <=20 then add 2 months else add 3 months and show the trial1_due_dt


If the K04 Date Is not null and FHA Trial Date is null then


            If day of K04 Date is <=15 advance 1 month else advance 2 months and show the trial1_due_dt


In the results the code works only if there is an FHA date.  In the case of non-FHA dates the trial1_due_dt is blank


1. Anyone know why I am getting blanks in these instances

2. Is there a more efficient way to write this code  Basically I want the trial_due_date to appear one way if FHA loan and another if it is not

1 Reply
Not applicable

Re: Scripting Help

May be try this:

If(Len(Trim([FHA Trial Date]) > 0,
     If(Day([FHA Trial Date]) <= 20,

          Date(MonthStart([FHA Trial Date], 2)),

          Date(MonthStart([FHA Trial Date], 3))),

If(Len(Trim([K04 Date])) > 0,
     If(Day([K04 Date]) <= 15,

          Date(MonthStart([K04 Date], 1)),

          Date(MonthStart([K04 Date], 2))))) as [trial1_due_dt] ,

Not sure I understand how this fit in?

If([LM Workout Status Act] = 'IN TRIAL', [FHA Trial Date],

if([LM Workout Status Act]='IN TRIAL',[K04 Date],