2 Replies Latest reply: Mar 12, 2018 11:48 AM by Jahanzeb Hashmi RSS

    Check if variable is null?

    William Fu

      I have this variable (null by default) that changes based on the user selection, using the qsVariable extension.

      However, I want my formulas display a specific value when there is no selection (when the app is first opened for example).

       

      Here's what I've tried:

       

      If(IsNull($(vSelectedMonth)),'T','F') -- returns "-"

      If(IsNull(vSelectedMonth),'T','F') -- returns 'F', even without any selection

      If(Len($(vSelectedMonth))<1,'T','F') -- returns "-"

       

      If(Len(vSelectedMonth)<1,'T','F') -- returns 'T', seems to work correctly, however when I apply the same logic to another variable, it doesn't work (returns "-"):


      If(Len(vSelectedMonth)<1,

      Dual(Year(Monthstart(Today(),-1))&'-'&Month(Monthstart(Today(),-1)),MonthStart(Today(),-1)),

      Dual(Year(Monthstart(MakeDate(2018,$(vSelectedMonth),1)))&'-'&Month(Monthstart(MakeDate(2018,$(vSelectedMonth),1))),

      MakeDate(2018,$(vSelectedMonth),1)))

       

      Any ideas?