cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Serviced2000
Helper III
Helper III

Displaying Selected Choice in Canvas App from CDS

Hi There,

 

I have been working on what should be a simple canvas app for three days and I'm close to hair tearing stage (if I had any). I need to display a gallery of items from one table with a relationship to another table. I've gone through the hoops of polymorphic fields and managed to do that, but the related table contains Choice columns. When I add these columns / fields to a form (I'm using an edit form) they display the options fine, but they don't show what the currently selected option is. 

 

So in my data I have Table 1 - 'Approvals' that links to Table 2 'Placement' via a field called 'Regarding'. when the Placement record is displayed on the edit form I can see the 'Type' field which contains 3 options and can select one, but it will not show the current selection (there will always be a current selection for this field in my data).

 

So far the formulas I've tried include :

 

Choices('Job Type')

ThisItem.Type

ThisItem.'Job Type' (Job Type being the name of the actual choice)

ThisItem.'Job Type'.Value

Gallery1.Selected.'Job Type'

AsType(Gallery1.Selected.Regarding, Placements).'Job Type'

AsType(Gallery1.Selected.Regarding, Placments).'Job Type'.Value

Choices('Job Type', AsType(Gallery1.Selected.Regarding, Placements).Type)

 

I've also watched Shane Young's video of working with Choices here : PowerApps Common Data Service Dataverse Option Sets - Create, Filter, Patch, and More - YouTube about a hundred times but Canvas seems to behave completely differently to the way it's behaving for me (that is, what appears to be the same reference e.g. Choices('Job Type') just does not work!)

 

None of which seem to even hint at my heading in the right direction.

 

Any help anyone can give me on this would be super valuable.

 

Thanks!

6 REPLIES 6
v-albai-msft
Community Support
Community Support

Hi @Serviced2000 ,

What's the Items property of your editform?

Do your edit form connect to Table1, and the chocie column which is called "Type" is in the Table2?

Could you please provide some screenshots to help us understand your issue better?

Besides, check if this article is useful to your issue:

https://powerapps.microsoft.com/en-us/blog/option-sets-and-many-to-many-relationships-for-canvas-app... 

Best regards,

Allen

Hi Allen,

 

Here is a screenshot of the editform with the Item property. The highlighted field is a choice field on the placement form, but doesn't populate when the item is selected (although the options are available).

 

Serviced2000_0-1627423472132.png

Here is the 'Type' Item setting

 

Serviced2000_1-1627423644520.png

 

And here is the choice option

 

Serviced2000_2-1627423683220.png

 

Although it looks slightly different in the placement record...

 

Serviced2000_3-1627423766242.png

So it many be a simple naming issue, but I would have expected the Choices('Job Type') item selection to work as that is the Choice item.

 

Thanks!

 

 

Hi @Serviced2000 ,

I still cannot understand. Seems this issue is not related to the relationship between your two tables.

So do you mean the selected value cannot be saved into your table2? Or do you mean when edit a record(like click one record from the gallery), this Type field does not show(if yes, try to set this dropdown control's DefaultSelectedItems property to "Parent.Default")?

I did a test on my side, and the Type field shows well when selecting an option through the dropdown:

valbaimsft_0-1627465386285.png

valbaimsft_1-1627465456734.png

valbaimsft_2-1627465614190.png

Best regards,

Allen

Hi Allen,

 

That's right, when I select an item from the gallery, the already selected option (from the CDS) record does not show in the dropdown window. I'll try the Parent.Default setting you suggested.

 

Thanks!

Ok, so this control doesn't have a DefaultSelectedItems property so I tried to set the Default value to Parent.Default. That didn't work either so I tried to set it to ThisItem.Type - still comes up blank. What I want is for the type that is in the CDS record to be reflected in the form when the record is selected from the Gallery. Like other items in this screenshot.

Serviced2000_0-1627527213192.png

 

 

 

 

 

 

Hi @Serviced2000 

What about removing this datacard and re-add this column? Seems that you don't do any changes of this column/datacard.

valbaimsft_1-1628041102193.png

Besides, I notice an error on your screenshot, click it and check the detailed error message.

valbaimsft_0-1628041044670.png

Best regards,

Allen

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

PowerPlatform 768x460.png

Microsoft Learn

Check out our new Discover Your Career Path blog post series and get all the details.

Users online (2,326)