Condition is true but shows wrong text

Hey!

App building is going well so far, but am getting an error when putting multiple conditions to an element.
I’m building a bilingual page and am adding translations to elements with conditions such as “when current user’s language is x, then show x text, when language is y, show y text”. So far has worked well, buut…

Initial content is ‘rent price €/Month’, but conditions should work like this:

  1. When art does NOT have a rental price (slot is empty) and language is English, show text ‘Not Available’.
  2. When art does NOT have a rental price (slot is empty) and language is Estonian, show text ‘Pole renditav’.
  3. When art HAS a rental price and language is Estonian, show text ‘rent price €/Kuu’.

As you can see from the screenshot, the text currently shown is from option 3, but when we look at option 2 from the debugger, then all conditions have been met (rent price is empty AND language is Estonian).
Now my question is, why does it not show option 2 instead of 3?
How could I fix this?

Your conditionals are set up incorrectly to achieve what you’re trying to achieve (you described them correctly in your post, but have not set them up that way in your app, as your debugger shows).

Your 3 current conditionals (as your debugger shows) are:

  1. Parent Group’s Rent Price is Empty
  2. Current User’s Language is Es and Parent Group’s Rent Price is empty
  3. Current User’s Language is Es

So, in your above example, the current user’s language is ES and the rent price is empty, so ALL 3 of your conditions have been met here. So it runs through all of them in order (1,2,3) finishing up on the last one, therefore displaying the text for option 3.

In order to achieve what you’re trying to achieve you need to add ‘And’ expressions to each of your conditionals to eliminate the other possibilities so that only 1 of your conditions can ever be met at a time.

Ha, of course. Added some extra 'and’s and it works as I intended it to. Thanks!

1 Like

This topic was automatically closed after 70 days. New replies are no longer allowed.