cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Frequent Visitor

Canvas app: Patch function with dropdown of CDS field items

Hi everyone.

So I want to take a picture with the camera, select a field in CDS from a dropdown and then patch that selected field.

I have a dropdown with say Items: ['field_a', 'field_b', 'field_c'] (referencing an entity in CDS)

Now, I could use multiple nested if statements for the Patch function:

If (Dropdown1.Selected.Value = 'field_a')

   Patch(EntityName, Gallery1.Selected, {'field_a': photoVariable}), and so on 

But there has to be a better way, no!?

I have tried multiple things without any success, get errors for all of them:

Patch(EntityName, Gallery1.Selected, {Dropdown1.Selected.Value: photoVariable})

Patch(EntityName, Gallery1.Selected, {'Dropdown1.TextValue': photoVariable}) and so on

Another thought was to reference the fields in the dropdown in another way, but no success there either.

Do you have any ideas of how I can get rid of all the If statements?

Thanks.

1 REPLY 1
Highlighted
Super User III
Super User III

Re: Canvas app: Patch function with dropdown of CDS field items

HI @POJA85 ,

I have done a blog on storing and viewing images which although SharePoint specific refers to the method of storing a photo as Base64 text in a multi-line text field. I am not sure on CDS, but you might try this method.

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Find your favorite faces from the community presenting at the Power Platform Community Conference!

Watch Now

Experience what’s next for Power Apps

See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (5,474)