Hello, I have a multiple if condition that returns a list, but what I need is for it to return the condition that is only true. Thankss!!!
if( {and( ri!tipo = "Alzada", a!isNotNullOrEmpty(ri!feRegistro), ), and( ri!tipo = "Reposición", a!isNotNullOrEmpty(ri!feRegistro), ), and( ri!tipo = "Revisión", a!isNotNullOrEmpty(ri!feRegistroAdmin), ), }, {ri!feRegistro + 90, ri!feRegistro + 30, ri!feRegistroAdmin + 30}, {ri!feRegistro, ri!feRegistro, ri!feRegistroAdmin} )
Discussion posts and replies are publicly visible
You have mixed up a lot of things here. Can you help me understand what are you trying to achieve? Try giving the sample input and desired output based on that input. That should help.
What I am trying here is that if it is of a type ("Alzada", "Reposición", "Revision"), the date that is completed in a field adds 90 or 30 days at the date selected
Using an if() with more than 3 parameters is not supported. This seems to be a more complex logic with more than a single output. We need more details.
the date is rule input ri!feRegistro, ri!feRegistroAdmin is a date, and tipo is a text
See if this helps.
if( or( ri!tipo = "Alzada", ri!tipo = "Reposición", ri!tipo = "Revisión" ), { ri!feRegaistro + 90, ri!feRegistro + 30, ri!feRegistroAdmin + 30 }, { ri!feRegistro, ri!feRegistro, ri!feRegistroAdmin } )
What I need is that it only returns the true condition instead of the list with the 3 conditions
You are getting 3 because the first parameter of your if() statement has 3 parameters. You need to wrap them in a function that returns only a single parameter. Like I have done above.
If all 3 need to be true, then use and(). Then return whatever single value you want to return when all 3 are true. Then whatever single value you want when they're not all 3 true.
If any of the 3 need to be true, use or(). Then whatever single value when any are true. Then whatever single value you want when all 3 are false.
If it's something else more complex than that, you might want to consider a!match(). Then you can specifically define each combination of your 3 inputs, and what it should return for each combination.
Agree