Skip to main content

Notifications

Power Apps - Building Power Apps
Unanswered

Canvas app: Patch function with dropdown of CDS field items

Posted on by

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.

  • WarrenBelz Profile Picture
    WarrenBelz 143,591 on at
    Re: Canvas app: Patch function with dropdown of CDS field items

    Hi @POJA85 ,

    Just checking if you got the result you were looking for on this thread. Happy to help further if not.

    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.

     

  • WarrenBelz Profile Picture
    WarrenBelz 143,591 on at
    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.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

November 2024 Newsletter…

November 2024 Community Newsletter…

Community Update Oct 28…

Power Platform Community Update…

Tuesday Tip #7 Community Profile Tips…

Welcome to a brand new series, Tuesday Tips…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 143,591

#2
RandyHayes Profile Picture

RandyHayes 76,308

#3
Pstork1 Profile Picture

Pstork1 64,090

Leaderboard