Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

IF in set identifier

Hello The Community,

So far, the community has answered all my question before asking, but now I'm stuck. So I hope you guys will help me

Here's the thing:

I am deseperatly trying to include an "IF" in a set identifer, but none of what I tried so far worked.

I am trying to count the number of existing Field_2 where Field_1 = vVariable_1, but if vVariable_1 is null, then I must count all the Field_2.

here is an example:

= count({$< Field_1 = If( IsNull( $(vVariable_1) ),'{*}',$(vVariable_1))>} Field_2)

I hope I made myself clear enough you would help me out.

Thanks in advance

3 Replies
swuehl
MVP
MVP

Why not create a second variable (let's call it vVariableCountExp):

=If( IsNull( $(vVariable_1) ),'"*"',$(vVariable_1))

and then use vVariableCountExp in your set element:

= count({$< Field_1 = {$(vVariableCountExp)} >} Field_2)

I don't think that you can use an if-conditon in the set element directly.

Stefan

jagan
Luminary Alumni
Luminary Alumni

Hi,

Can you try like this

If( IsNull( $(vVariable_1) ),  count({$< Field_1 = {'*'}>} Field_2),    

     count({$< Field_1 = {$(vVariable_1)}>} Field_2))

Hope this helps you.

    

Regards,

Jagan.

Not applicable
Author

Okay that works for one.

But in fact, I have 4 différent Fields to set.

Like Count({$<Field_1 = X1, Field_2 = X2, Field_3 = X3, Field_4 = X4>} Field_5)

And for each one I have to select either the Value of Xn or *.

It would mean to many imbricated to many different if, to assure all possible solution.