web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Taking image and setti...
Power Apps
Answered

Taking image and settin a variable with it

(0) ShareShare
ReportReport
Posted on by 413

Hi there. 

 

I have to play with pictures today 🙂

 

Situation: I have a form in a view, which is compiled using variables setted in other views.

The reason to do this is unknown to me, I'm not the author. I suppose that the author didn't like to work with copies of one form, so she finds a solution using only one form and using variables in each view that need to compile the form.

 

The user can choose a view with a button, then he has to compile some text/numeric fields. Doing this, the app initialize some variables used to compile the form stored in an invisible view. A last button used to send the data to a Sharepoint list contains the "Submitform()" command.

 

 

Now, this works fine if I have text or number data. 

But I need to get the same logic using images taken from camera. I used to take pictures directly with Attachment field of a form, but it seems to be not feasible in this contest. 

 

Do you have some ideas?

Thanks.

Categories:
  • Verified answer
    v-mengmli-msft Profile Picture
    Microsoft Employee on at

    Hi @Calcioscacchi ,

     

    If you want to update the image to the attachment column, the data is required to have the format of Table( attachment), I have given a detailed answer on how to update the image to the attachment column.

    I have attached a video link for your reference: Power Apps SharePoint List Attachments | Save Camera Pictures, Pen Input & Images - YouTube

    I assuming you create a variable to save the value of image:

    Set(variable,camera.Photo)

    1)Create an empty collection about SP's attachments.

    OnSelect:ClearCollect(testpicture,Defaults(ListName).Attachments)

    2)Patch the photo to collection:

    OnSelect:Collect(testpicture,{DisplayName:GUID()&".jpg",Id:GUID()&".jpg",Value:variable})

    3)Patch the collection to attachemnts:

    OnSelect:Patch(ListName,Defaults(ListName),{Title:"test",Attachments:testpicture})

    Please get back to me if you have any questions.

     

    Thanks!

    Rimmon

  • Calcioscacchi Profile Picture
    413 on at

    Great work from Reza here, it's actually what i'm looking for.

    Just a problem: I need to Reset the attachment control outside of its form. Documentation says that it's not feasible:

     

    Reset function - Power Platform | Microsoft Learn

     

    But I really need to. There is some workaround to manage this?

  • v-mengmli-msft Profile Picture
    Microsoft Employee on at

    Hi @Calcioscacchi ,

     

    There is another way to clear files in attachment control:

    1)OnSelect of button:

    Set(var,true)

    2)Default of attachment control:

    If(!var,Parent.Default)

     

    If my answer solves your question, please accept it as a solution.

    If you have another question, you can post it in community to get instant solutions.

     

    Best regards,

    Rimmon

  • Calcioscacchi Profile Picture
    413 on at

    Hi there, I solved my problem with a copy in each view of my form. 

     

    The structure of this App doesn't fit with this my need, I solved changing the structure. 

     

    Thanks to all.

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 248 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 192 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 135

Last 30 days Overall leaderboard