Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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?
Got it to work by removing the dollar sign expansions from the formula:
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)))
Don't quite know why that works, so explanations are welcome!
to me, it Should work without () even. I think $ is for the second layer of calculation.
Regards