Problems: OptionSets in Power Apps (Canvas apps can be a little nasty to work with, today I took a couple of hours trying to use an OptionSet to filter results. This should have taken 5 minutes but there is a weird behavior when using switch or if statements to dynamically filter using options sets.
Hypothesis: using if/switch logic when using an OptionSet in Dataverse to filter results in the code being change/interpreted incorrectly at run time.Resolution: Use a variable to hold the dynamic OptionSet choice as shown above. I hope this post can help anyone having issues relating to Option sets for filtering and updating.
In the example below I show how to Insert a new Row using a Patch where the row contains an OptionSet. It's ugly but, it works...
On the Save...
Set(orgType, Blank());
If(
<ddlOrgType.Value> = "Personal", Set(orgType, 'Org Type'.'Sole Trader'),
<ddlOrgType.Value> = "Incorporated", Set(orgType, 'Org Type'.'Limited Company'),
<ddlOrgType.Value> = "Partnership", Set(orgType, 'Org Type'.'Partnership')
);
No comments:
Post a Comment