How to do multiple logic operations

Hi!

I’m new to wappler and only have very little experience of programming and building database driven websites.

There is probably a very simple soulution to my problem.

Im trying to check if one of two (or more) strings are true and if so, then check if a second value is true.

I have tried something like this (it din’t work :slight_smile:)

con_user_details.data.qry_user_details.user_role == ('basic' || 'planner') && (present == 0)

Also, big thanks to the wappler-team for creating this amazing software!

Thankfull for your help!

1 Like

Maybe have a look at using a Flow in app connect.

There you will be able to chain together a number IF conditions to check your strings.

If also suggest to try and stick with using the dynamic bindings chooser to make sure the syntax will be correct.

That’s where I’d start.

1 Like

Your OR syntax is a common mistake, as it follows what we would verbalize. However it is actually:

(con_user_details.data.qry_user_details.user_role == 'basic' || con_user_details.data.qry_user_details.user_role  == 'planner') && (present == 0)

EDIT: If you have a long list of items to be compared, this syntax would also work:

(['basic', 'planner'].contains(con_user_details.data.qry_user_details.user_role)) && (present == 0)
3 Likes

Thank you for your help and swift reply!

I’ve never worked with the Flow component but will take your advice and dive in to it.
I dont understand what you mean with:

stick with using the dynamic bindings chooser

The code is part of a dmx-show and the full code looks like this:

<p class="mb-0 mr-2" dmx-show="con_user_details.data.qry_user_details.user_role == ('basic' || 'planner') && (present == 0)"><i class="fas fa-times text-danger fa-lg"></i></p>

Have i missed something?

@Mattias_Andersson please check @mebeingken’s reply, he has the right syntax in his post.

1 Like

Hi Teodor!

Thankd for the reply!

Im trying his answer now and writing to him now (im not so fast with the keys :sweat_smile:)

1 Like

Hi Ken!

Thank you for your help it works beautifully!

This was exactly what i was looking for!

1 Like