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

New records for a picture

Hi,

I am trying to use "AddMediaButton" to put some picture in my Excel.

My OnSelect to valid the picture is :

"Patch(Liste;Defaults(Liste);{Photo :AddMediaButton1.Media};{ID:Value(Max(Liste; ID))});; Navigate(BrowseScreen1)"

It's create a new record instead of modifie the link of my picture in the row "photo"...

Do you have an idea?..

Many thanks

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @JBpowerapps ,

1)The syntax is:
Patch(table,item to modify,{...})

The second parameter should be the record that you want to update in your list.

Usually we use First(Filter()) or LookUp() function to get that record.

So this part "LookUp(Liste,ID=Value(Max(Liste; ID))" is right.

 

2)Please tell me the data type of your photo field.

If it is picture type, I'm afraid it's read-only in powerapps. You can not update picture data type in powerapps.

If it is hyperlink type, you could update this field in powerapps.

However, you need to update this field will url link, not "AddMediaButton1.Media".

"AddMediaButton1.Media" is just a blob data, which is not a url.

You have two solutions:

  • upload this local photo to cloud, update this field with url
Patch(Liste;LookUp(Liste,ID=Value(Max(Liste; ID)));{Photo :url});; Navigate(BrowseScreen1)
//fill in picture url
  • still want to update by using addpictue button. Then you need to create a flow, which use the picture uploaded to addpictue button to create a file and save in sharepoint library, then generate a link for this file, use this link to update this field.

Here's a blog about how to create this kind of flow in details for your reference:
http://www.cleverworkarounds.com/2019/06/08/getting-pics-to-sharepoint-from-powerapps-is-getting-eas...

 

Best regards,

 

 

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
Super User
Super User

Hi,

 

I recommend making life easy and use SharePoint and add them as attachment

 

If you want you can send me an email jay@research-nest.com and I will help you via teams

 

Jay

Community Support
Community Support

Hi @JBpowerapps ,

Do you want to edit photo in one existing record?

Firstly , I suggest you know more about the Patch function.

Patch function's syntax:

1)create a new record

Patch(table,Defaults(table),{...})

2)edit an existing record

Patch(table,item to modify,{...})

 

In your issue, you should use the second formula, not using Defaults(...).

 

Secondly, to upload image from powerapps to excel, you need to name that image field like this:

fieldname[image]

 

Thirdly, the updating formula should be like this:

Patch(Liste;
      LookUp(Liste,ID=Value(Max(Liste; ID)));
      {Photo :AddMediaButton1.Media}
      );; Navigate(BrowseScreen1)

 

 

Best regards,

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi 

 

Thanks for your answer,

I don't understand which line code I should use

Patch(Liste;{Photo};{Photo:AddMediaButton1.Media};{ID:record.ID});; Navigate(BrowseScreen1) 

or

 Patch(Liste;LookUp(Liste,ID=Value(Max(Liste; ID)));{Photo :AddMediaButton1.Media});; Navigate(BrowseScreen1)

 

both are not working...

Thanks for your help

Hi @JBpowerapps ,

1)The syntax is:
Patch(table,item to modify,{...})

The second parameter should be the record that you want to update in your list.

Usually we use First(Filter()) or LookUp() function to get that record.

So this part "LookUp(Liste,ID=Value(Max(Liste; ID))" is right.

 

2)Please tell me the data type of your photo field.

If it is picture type, I'm afraid it's read-only in powerapps. You can not update picture data type in powerapps.

If it is hyperlink type, you could update this field in powerapps.

However, you need to update this field will url link, not "AddMediaButton1.Media".

"AddMediaButton1.Media" is just a blob data, which is not a url.

You have two solutions:

  • upload this local photo to cloud, update this field with url
Patch(Liste;LookUp(Liste,ID=Value(Max(Liste; ID)));{Photo :url});; Navigate(BrowseScreen1)
//fill in picture url
  • still want to update by using addpictue button. Then you need to create a flow, which use the picture uploaded to addpictue button to create a file and save in sharepoint library, then generate a link for this file, use this link to update this field.

Here's a blog about how to create this kind of flow in details for your reference:
http://www.cleverworkarounds.com/2019/06/08/getting-pics-to-sharepoint-from-powerapps-is-getting-eas...

 

Best regards,

 

 

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Helpful resources

Announcements
New Badges

New Solution Badges!

Check out our new profile badges recognizing authored solutions!

New Power Super Users

Congratulations!

We are excited to announce the Power Apps Super Users!

Power Apps Community Call

Power Apps Community Call: February

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

Top Solution Authors
Top Kudoed Authors
Users online (76,862)