cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
liambm
New Member

Patching Add Picture control to image column in CDS

Hello

 

I'm building a PowerApp to collect data from a user utilising controls and then patching to CDS. Mostly seems to work perfectly fine, but I am having some difficulty with the Add Picture control.

 

I have a column in the database table called "Photo" and the data type is set to image. I have an Add Picture control called "addPhotoFault", to allow the user to add an image from their device, which I am trying to patch to that column using the following code:

 

Patch('Thermo Faults', Defaults('Thermo Faults'), {technician: TextInputTechnician.Text, switchboard: textInputSwitchboard.Text, faultDetails: textInputFaultDetails.Text, simproJobNumber: Value(TextInputSimproJobNo.Text), jobFaultId: varfaultNo, generalNotes: textInputGeneralNotes.Text, relatesToFaultNumber: textInputRelatesToFaultNo.Text, clientName: TextInputClientName.Text, panel: textInputPanel.Text, siteName: TextInputSiteName.Text, area: textInputArea.Text, component: textInputComponent.Text, photo: {full: addPhotoFault.Media, value:addPhotoFault.Media});

 

Code is based on about an hour or so of searching various forums.

 

It patches the data just fine without the image. When I try and patch the image to CDS I keep getting an error stating "Invalid argument type. Expecting a Record value, but of a different schema."

 

Any help would be much appreciated.

1 ACCEPTED SOLUTION

Accepted Solutions
timl
Super User III
Super User III

Hi @liambm 

The add picture control is a composite control that includes an image control. In my example beneath, it's called UploadedImage1. This is what you can refer to in your call to Patch.

 

timl_0-1614601282470.png

Therefore, if you adapt your code like so, that should hopefully work.

Patch('Thermo Faults', Defaults('Thermo Faults'), {technician: TextInputTechnician.Text, switchboard: textInputSwitchboard.Text, faultDetails: textInputFaultDetails.Text, simproJobNumber: Value(TextInputSimproJobNo.Text), jobFaultId: varfaultNo, generalNotes: textInputGeneralNotes.Text, relatesToFaultNumber: textInputRelatesToFaultNo.Text, clientName: TextInputClientName.Text, panel: textInputPanel.Text, siteName: TextInputSiteName.Text, area: textInputArea.Text, component: textInputComponent.Text, photo: UploadedImage1.Image);

 

View solution in original post

2 REPLIES 2
timl
Super User III
Super User III

Hi @liambm 

The add picture control is a composite control that includes an image control. In my example beneath, it's called UploadedImage1. This is what you can refer to in your call to Patch.

 

timl_0-1614601282470.png

Therefore, if you adapt your code like so, that should hopefully work.

Patch('Thermo Faults', Defaults('Thermo Faults'), {technician: TextInputTechnician.Text, switchboard: textInputSwitchboard.Text, faultDetails: textInputFaultDetails.Text, simproJobNumber: Value(TextInputSimproJobNo.Text), jobFaultId: varfaultNo, generalNotes: textInputGeneralNotes.Text, relatesToFaultNumber: textInputRelatesToFaultNo.Text, clientName: TextInputClientName.Text, panel: textInputPanel.Text, siteName: TextInputSiteName.Text, area: textInputArea.Text, component: textInputComponent.Text, photo: UploadedImage1.Image);

 

View solution in original post

liambm
New Member

Works perfectly, thank you so much. A little embarrassed I didn't think of that myself.

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

Power Apps Community Call

Monthly Power Apps Community Call

Did you miss the call?? Check out the Power Apps Community Call here!

secondImage

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 the go-to Power Platform destination for ISV’s to monitor & manage applications post-AppSource publish.

Top Solution Authors
Top Kudoed Authors
Users online (12,307)