Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I need to display logmonth only for the user selected Duemonths. Below expression works fine if one duemonth is selected, but when I select multiple values in duemonth, it doesn't work. Can you please suggest how to achieve this?
=if(logmonth=GetFieldSelections(DueMonth),logmonth)
This should work I think:
=If( Match( logmonth , $(=Chr(39) & GetFieldSelections(DueMonth,Chr(39)&','&Chr(39),12) & Chr(39) ) ), logmonth )
The entire expression between $( and the next to last ) will be evaluated and the result will be put into the outer expression verbatim and then the rest of the outer expression will be evaluated.
So if you have selected January, March and June in DueMonth this expression:
Chr(39) & GetFieldSelections(DueMonth), Chr(39) & ',' & Chr(39) , 12) & Chr(39)
will evaluate to this string:
'January','March','June'
and this will due to the $-sign expansion be put in so the outer expression will become:
=If( Match( logmonth , 'January','March','June' ), logmonth )
Which will return a true value (a positive number) if there are any matches.
This should work I think:
=If( Match( logmonth , $(=Chr(39) & GetFieldSelections(DueMonth,Chr(39)&','&Chr(39),12) & Chr(39) ) ), logmonth )
The entire expression between $( and the next to last ) will be evaluated and the result will be put into the outer expression verbatim and then the rest of the outer expression will be evaluated.
So if you have selected January, March and June in DueMonth this expression:
Chr(39) & GetFieldSelections(DueMonth), Chr(39) & ',' & Chr(39) , 12) & Chr(39)
will evaluate to this string:
'January','March','June'
and this will due to the $-sign expansion be put in so the outer expression will become:
=If( Match( logmonth , 'January','March','June' ), logmonth )
Which will return a true value (a positive number) if there are any matches.
Thanks Petter for the quick response and nice explanation.
In one more case, I'm trying to put same logic in SET Analysis. but it is not working, Can you please check what's wrong here.
sum({<logmonth=$(=Chr(39) & GetFieldSelections(DueMonth,Chr(39)&','&Chr(39),12) & Chr(39)) >}sales)
Sum( {<logmonth= { $(=Chr(39) & GetFieldSelections(DueMonth,Chr(39)&','&Chr(39),12) & Chr(39) ) } >} Sales)
Does this works also on Date fields?
Yes - it does. However you might reconsider the third parameter which is set to 12 in the specific example over as you might not want a restriction to maximum 12 values but much higher.
Be sure to have a look at the documentation especially when it comes to this third parameter.