cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
SaWu
Level 8

"in" and "exactin" still don't work for (new) OptionSetValue

Hello

Please be so kind as to read my full post before responding.
Thank you for your consideration.

Since already several versions, "Relational data, options sets, and other new features for CDS", is, by default, turned on.
This changes all option set values to the new OptionSetValue type.
The "in" and "exactin" operators don't seem to be working with this OptionSetValue type.
image.png
https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/operators

I want to use this to test if certain values are selected in CDS/Dynamics multiselect option set fields.


To give an example, in CDS, I have a global option set "optionset 01" with options "01.01" through "01.10".
image.png
In PowerApps, single values can be obtained with "'optionset 01'.'01.01'" through "'optionset 01'.'01.10'".
All values can be obtained with "Choices('optionset 01')".
I have set a Label with Text

"Tests:
" & (1 in [1] ) & "
" & (true in [true]) & "
" & ("Test" in ["Test"]) & "
" & ('optionset 01'.'01.01' in Choices('optionset 01')) & "
" & ({Value: 'optionset 01'.'01.01'} in Choices('optionset 01')) & "
" & (!IsEmpty(Filter(Choices('optionset 01'), Value='optionset 01'.'01.01'))) & "
" & ('optionset 01'.'01.01' in ['optionset 01'.'01.01']) & "
" & ({Value: 'optionset 01'.'01.01'} in ['optionset 01'.'01.01']) & "
" & (!IsEmpty(Filter(['optionset 01'.'01.01'], Value='optionset 01'.'01.01')))

This yieldsimage.png

As visible in this screenshot, the "in" operator does not seem to work for the option set values in the same way as for numbers, booleans or strings.
Also, please note the workarounds

({Value: 'optionset 01'.'01.01'} in Choices('optionset 01')) &&
(!IsEmpty(Filter(Choices('optionset 01'), Value='optionset 01'.'01.01')))

which yield the correct result.
Apparently, comparison of option set values with "=" works, and thus, using the "record version of in" or Filter with explicit comparison with "=" both work.

It appears as if the comparison against the column Value of the "Inline value tables", such as also returned by Choices, or used as representation of multiselect option set fields, doesn't yet properly work.
image.png
https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/working-with-tables

The same applies to the "exactin" operator, see for example another Label with Text

"Tests:
" & (1 exactin [1] ) & "
" & (true exactin [true]) & "
" & ("Test" exactin ["Test"]) & "
" & ('optionset 01'.'01.01' exactin Choices('optionset 01')) & "
" & ({Value: 'optionset 01'.'01.01'} exactin Choices('optionset 01')) & "
" & ('optionset 01'.'01.01' exactin ['optionset 01'.'01.01']) & "
" & ({Value: 'optionset 01'.'01.01'} exactin ['optionset 01'.'01.01'])

image.png

Please see also this earlier post on the same issue:
https://powerusers.microsoft.com/t5/Building-PowerApps-Formerly/quot-in-quot-operator-not-working-fo...


Please note that this post is more a information to fellow PowerApps users and complaint/bug report for the backend team.
I don't need "help".
I do have a workaround.

Last tested with
PowerApps Release: 3.19093.16
App Id: 854c44bd-1067-46f2-a8b8-b4f1aa77dbb1
Session ID: 26a25700-94c4-4bbe-aed4-3c393e08d11e
image.png

Thank you,
     Sa Wu.

2 REPLIES 2
Community Support Team
Community Support Team

Re: "in" and "exactin" still don't work for (new) OptionSetValue

Hi @SaWu ,

Thanks for your sharing.

 

Yeah, you are right. The 'in' operator has not been supported to compare a Option Set value with a OptionSetValue result (e.g. Choices('Option Set Name')).

 

If you would like this feature to be added in PowerApps, please submit an idea to PowerApps Ideas Forum:

https://powerusers.microsoft.com/t5/PowerApps-Ideas/idb-p/PowerAppsIdeas

 

As an alternative solution, I agree with you. I would also share your solution to other users who facing this issue.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
SaWu
Level 8

Re: "in" and "exactin" still don't work for (new) OptionSetValue

Hi @v-xida-msft 

I don't really see why it is necessary to suggest this "feature", which I would have assumed to be natural and currently buggily missing, as an idea, but I did it anyway:
https://powerusers.microsoft.com/t5/PowerApps-Ideas/Make-quot-in-quot-and-quot-exactin-quot-operator...

Thanks,
    Sa.

Helpful resources

Announcements
thirdimage

New Badges

Check it out!

thirdimage

Power Apps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

Top Solution Authors
Top Kudoed Authors
Users online (6,628)