If/Then Condition in Trigger related query

Hi Team,

I’m very new to Tulip Platform. Can you please guide me below given condition how we can achieve in Tulip Button Trigger IF/THEN?

IF(TotalStage is  2)
{
       IF(UG1 text is empty)
       {
            Show Error Message to fill UG1
       }
      IF(UG2 text is empty)
      {
          Show Error Message to fill UG2
      }
}

Thanks & Regards,
Arun C

Howdy Arun!

Welcome to Tulip and the Tulip Community! We are glad you are here :slight_smile:

I want to point you to a couple resources that can give you a great overview of Tulip triggers and help you get comfortable with how they work.
https://support.tulip.co/docs/triggers

But to answer your question directly, I attached an example below of something that would work - there are options to tweak this / do the logic a little different so I encourage you to play around and see what works best for you. You can always test you logic in the “Developer Mode” as you build your apps.

Hi @Beth,

this is not the same :wink:

If your Trigger finds that UG1 is empty, it will not check for UG2.

You could:

  • Build a more or less complex expression
  • Use Two Triggers like this (one for UG1 & one for UG2):

Unfortunately, this is already in an else statement at @Arun 's App. That means twice the same Trigger is no solution (it would repeat the other actions as well…)

I would rethink the usecase.
You could:

  • check if UG1 or UG2 are empty and make one message “Make sure UG1 and UG2 are filled correctly”
  • Check for a minimum length of UG1 & or UG2
  • Check in separate triggers & use a helper variable to transport the result into the correct triggers else statement

You can make the use case as easy or complex as needed (you even could use a SQL connector function to deliver the result :smiley: )

It depends on the use case…

1 Like

@thorsten.langner you are correct! thanks for pointing that out and for the additional input :grinning:

@Arun let us know if you need additional help or if this is enough to get you going in the right direction

1 Like

I would do two distinct sequential triggers on the button:
image

1 Like

Hi @Tim_Reblitz, @Beth and @thorsten.langner,

Thank you all for your quick suggestions.

Based on your inputs I understand that we can’t able to include AND & OR condition’s in same if/then statement also If inside multiple if condition statements.

I have resolved my use case in another way. Let me explain solution to my use case here.

TotalStages - Mandatory Inputs
1 - UG1
2 - UG1,UG2
3 - UG1,UG2,UG3
4 - UG1,UG2,UG3,UG4

IF(TotalStage >=   1) AND (UG1 text is empty)
{
            Show Error Message to fill UG1      
}
ELSE IF(TotalStage >=  2) AND (UG2 text is empty)
{
            Show Error Message to fill UG2      
}
ELSE IF(TotalStage >=  3) AND (UG3 text is empty)
{
            Show Error Message to fill UG3      
}
ELSE IF(TotalStage >=  4) AND (UG4 text is empty)
{
            Show Error Message to fill UG4      
}

Above attached validation code is working fine for me.

Thanks & Regards,
Arun C

Hi @Arun,

in fact it is possible to make an And&Or in one If statement… with limitations.
E.g. this approach, does not make separate Messages for UG1 and UG2, but checks both…

You could even solve this with one expression, however it gets less readable:

2 Likes

HI @thorsten.langner ,

This looks fine. But in my use case I have display the different message statements. Is there any possibility to write if /throw kind of expression with custom ‘TEXT’ output?

Thanks & Regards,
Arun C

You could build your Message like so:

You will still need the conditions, because you don’t want an empty error message to appear.

3 Likes

Its great @thorsten.langner. It really helps me lot in my app.

1 Like