How to check if a value exists in a list of given values?

Hello,

For example I have a boolean expression and I would like to set its value is True if fruit value in Session is "orange", "apple" or "lemon" and False if fruit is none of them.


I can do it with:

Session.fruit = "orange" or

Session.fruit = "apple" or

Session.fruit = "lemon" 


In case of I have 20 fruit names and I don't want to give 20 lines for it, are there any way to write it shorter? I expect something like :

Session.fruit in ("orange", "apple","lemon")

but I'm not familiar with Outsystems formular syntax.


Thank you!

thunemo wrote:

Hello,

For example I have a boolean expression and I would like to set its value is True if fruit value in Session is "orange", "apple" or "lemon" and False if fruit is none of them.


I can do it with:

Session.fruit = "orange" or

Session.fruit = "apple" or

Session.fruit = "lemon" 


In case of I have 20 fruit names and I don't want to give 20 lines for it, are there any way to write it shorter? I expect something like :

Session.fruit in ("orange", "apple","lemon")

but I'm not familiar with Outsystems formular syntax.


Thank you!


Hi,

You can use ListFilter action for this to filter the particular record.



Thanks,

Sachin

thunemo wrote:

Hello,

For example I have a boolean expression and I would like to set its value is True if fruit value in Session is "orange", "apple" or "lemon" and False if fruit is none of them.


I can do it with:

Session.fruit = "orange" or

Session.fruit = "apple" or

Session.fruit = "lemon" 


In case of I have 20 fruit names and I don't want to give 20 lines for it, are there any way to write it shorter? I expect something like :

Session.fruit in ("orange", "apple","lemon")

but I'm not familiar with Outsystems formular syntax.


Thank you!

Hi Please see listted function in OS that will hekp you to find that word in string.


https://success.outsystems.com/Documentation/How-to_Guides/Logic/How_to_find_out_if_a_string_is_contained_in_another_string



thunemo wrote:

Hello,

For example I have a boolean expression and I would like to set its value is True if fruit value in Session is "orange", "apple" or "lemon" and False if fruit is none of them.


I can do it with:

Session.fruit = "orange" or

Session.fruit = "apple" or

Session.fruit = "lemon" 


In case of I have 20 fruit names and I don't want to give 20 lines for it, are there any way to write it shorter? I expect something like :

Session.fruit in ("orange", "apple","lemon")

but I'm not familiar with Outsystems formular syntax.


Thank you!

HI,


Please check if that is useful to you.