Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
ashis
Creator III
Creator III

GetFieldSelections with AND condition not working

Hi , I have a listbox called City and it has few city names. 

I want one button to show or hide if city selection is either Boston or Washington , or both.

so i but the below condition in the button;

=if(GetFieldSelections(City)='Boston' or GetFieldSelections(City)= 'Washington',1,
if(GetFieldSelections(City)='Boston' and GetFieldSelections(City)= 'Washington',1,0))

It works if either one city is selected but do not work if Boston and Washington are selected. 

Any thought please.

Thanks,

Ashis

Labels (1)
3 Solutions

Accepted Solutions
sultanam
Contributor III
Contributor III

Hi,

try below one

=if(GetFieldSelections(City)='Boston' or GetFieldSelections(City)='Washington' or
GetFieldSelections(City)='Boston, Washington',1,0)

Regards,

Sultan

View solution in original post

marcus_sommer

Maybe this approach is more suitable:

wildmatch(concat(distinct City, ','), '*Boston*', '*Washington*')

- Marcus

View solution in original post

sunny_talwar

You can also try this

SubStringCount(Concat(DISTINCT '|' &City & '|'), '|Boston|') = 1
or
SubStringCount(Concat(DISTINCT '|' &City & '|'), '|Washington|') = 1

View solution in original post

7 Replies
sultanam
Contributor III
Contributor III

Hi,

try below one

=if(GetFieldSelections(City)='Boston' or GetFieldSelections(City)='Washington' or
GetFieldSelections(City)='Boston, Washington',1,0)

Regards,

Sultan

marcus_sommer

Maybe this approach is more suitable:

wildmatch(concat(distinct City, ','), '*Boston*', '*Washington*')

- Marcus

sunny_talwar

You can also try this

SubStringCount(Concat(DISTINCT '|' &City & '|'), '|Boston|') = 1
or
SubStringCount(Concat(DISTINCT '|' &City & '|'), '|Washington|') = 1
ashis
Creator III
Creator III
Author

Thank you so much, it works.
ashis
Creator III
Creator III
Author

Thank you for your reply. it works.
ashis
Creator III
Creator III
Author

Thank you Marcus, it works.

ashis
Creator III
Creator III
Author

Thank you Sunny, it works also.😁