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

"in" operator not working for OptionSetValue with "Relational data, options sets, and other new features for CDS"

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

I my PowerApp for a Dynamics/CDS entity I have a multiselect optionset field kk_display_fields_special using a global option set 'Felder: besondere'.
I am using this field to set the visible properties of certain special data cards in one form.
One option of this option set is kk_vcard_front.
One record of this custom entity in my PowerApp is userConfig.
In older versions before the feature "Relational data, options sets, and other new features for CDS", I could use code like

"kk_vcard_front" in userConfig._kk_vcard_front_label.Value

to test if this particular option set was selected.

With the "Relational data, options sets, and other new features for CDS" feature, this in operator does not seem to work with the optionset values as I would expect for full support of option set.
I have depicted this in the following screenshots of the formula for the Text property of a Label control and the corresponding Text the label displays:

(CountRows(Filter(userConfig.kk_display_fields_special, Value='Felder: besondere'.kk_vcard_front)) > 0) & "
" & ('Felder: besondere'.kk_vcard_front in userConfig.kk_display_fields_special) & "
" & ('Felder: besondere'.kk_vcard_front in userConfig.kk_display_fields_special.Value) & "

" & Concat(userConfig.kk_display_fields_special, Text(Value), ";")

image.png
image.png
As you can see, kk_vcard_front is selected.
Also, have found a clumsy workaround.
But, I would strongly prefer if the in operator would simply work as expected even with the new feature that introduces OptionSetValue.
Please let me know, if there is a more direct way to do my "set contains optionsetvalue" test.

4 REPLIES 4
Community Support Team
Community Support Team

Re: "in" operator not working for OptionSetValue with "Relational data, options sets, and other new features for CDS"

Hi @SaWu ,

Based on the issue that you mentioned, I have made a test, and the issue is confirmed on my side.

 

When the "Relational data, options sets, and other new features for CDS" funationality is supported within PowerApps, the OptionSetValue data type is supported within PowerApps.

The result the 'Felder: besondere'.kk_vcard_front formula returns is a OptionSetValue, which could not be compared to a Table value (the result the userConfig.kk_display_fields_special formula returns).

 

Currently, within PowerApps, I afraid that there is no way to compare the OptionSetValue with a Table value. As an alternative solution, I agree with your thought almost.

You could consider take a try to use the following formula to check if the specific OptionSet value is existed within a record:

!IsEmpty(Filter(BrowseGallery1.Selected.MultiStatus, Value = ApprovalStatus.Approved)) /* <-- Return false, means that the specific Option Set value is not existed within a record */

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.
TopShelf-MSFT
Level 10

Re: "in" operator not working for OptionSetValue with "Relational data, options sets, and other new features for CDS"

Hi @SaWu can you review the above reply and update the thread when you have a chance? 

 

Thank you,

 

@TopShelf-MSFT 

SaWu
Level 8

Re: "in" operator not working for OptionSetValue with "Relational data, options sets, and other new features for CDS"

I have read the reply.
It confirms my problem but has otherwise not been helpful.

SaWu
Level 8

Re: "in" operator not working for OptionSetValue with "Relational data, options sets, and other new features for CDS"

Hello,

The issue still persists in recent releases.
Last tested with
Session ID: 8f035538-33d6-4109-a074-95feb8f2ca20
PowerApps 3.19074.24

Here's one example where "in" inside Filter yields an empty Gallery
image.pngimage.png
while the corresponding statement using = and || yields a properly filled Gallery.image.pngimage.png

Thanks,
    Sa Wu.

Helpful resources

Announcements
Better Together’ Contest Finalists Announced!

'Better Together’ Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

thirdimage

Power Apps Community User Group Member Badge

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

sixthImage

Join THE global Microsoft Power Platform event series

Attend for two days of expert-led learning and innovation on topics like AI and Analytics, powered by Dynamic Communities

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

thirdimage

Microsoft Business Applications Virtual Launch

Join us for the Microsoft Business Applications Virtual Launch Event on Thursday, April 2, 2020, at 8:00 AM PST.

thirdimage

Community Summit North America

Innovate, Collaborate, Grow - The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Top Kudoed Authors
Users online (8,619)