Multi-level conditions in triggers

Could not find a good match in the search…

It is a real pity there is no support for sub-level conditions. When things get complex this forces you to do a lot of awkward case checking to hopefully match all faulty cases.

I have a bunch of conditions that I need to check only if a certain condition is matching. If that initial check is not passed I can directly throw an error.

Currently this kind of logic is not possibly to build in Tulip - at least not without either a custom widget, multiple steps in sequence or the mentioned case negation which is prone to unintended errors.

if (destination==="XYZ") {
    if (b==="A") {
        // do this
    } else if (b==="B") {
        // do that
    }
} else {
    // raise general error
}

Hi Sebme,
Having used “scripted” programming languages all my life I missed the ability to do nested IF / ELSE statement. I found that I just need to “think” in a different way to tackle cases like this. Most of the time the nested structure can be flattened and simplified. IMO if we cant do that, then there is a problem in the logic.
Personally i would love if Tulip offers an expression window to type in some Java script to check conditions. Tulip offers custom widgets but it is an over kill just to do a check. Until then my solution is below…

if (destination=="XYZ" & b=="A" ) {   
        // do this
    }
else if (destination=="XYZ" & b=="B") {
        // do that
    }
else if (destination != "XYZ") {
    // raise general error
}
else if (destination = null) {
    // raise warning 
}

Thank you for the example. Tulip claims to make things easy. What you show is not easy. It also shows that accomplishing something along those lines currently requires you to put a mile long trigger function together which just due to its size and length is difficult to comprehend, debug and even to build with all the clicking involved.

You can nest your Statements. I guess I know what you mean but to really check it there is a real example helpful.

Your case is solvable like so:

Result:



Hi all, thanks for the great feedback, we agree! We are currently working on a next generation trigger editor that will make all of this possible and more. Our current trigger editor has served very well for a majority of use cases, but as customers do more and more with Tulip you can run into examples as you describe. We aim to take this to the next level to provide more powerful tools while remaining simple and true to our no-code roots.

4 Likes

Hi @pete,

that sounds good to me.
Do you also plan to optimize the Expression editor?

  • tabs for “functions”, “Variables”, “App Infos”, “Table Records”… for easyer overview without scrolling a lot
  • less bulky names for value inputs (V. for Variables, T. for Table records, A. for App Infos… e.g. V.Value1 instead of Variable.Value1) becuase it is often longer than the width
  • open in a small resizable window (current solution is really tiny)
  • allow navigation with “end”-Key “Pos1”-Key “up”- key and “down”-key
  • allow changing a Variable Name without deleting the whole Variable (@variable.Value1 → backspace → 2 → @variable.Value2 would be a common use case)
  • allow line breaks and tabulator (eg as 3x whitespaces) to structure the “code” without breaking it (maybe shrink it for preview but keep it in edit window)

These are some of the most relevant issues to me about the Expression editor.

Is something in the pipe about that?

4 Likes

@thorsten.langner Yes, we are looking at that too. There will be quite a few improvements to how you find and pick items in general across Tulip, as well as the Expression Editor specifically.

2 Likes