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

Notifications

Announcements

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:
I have the same question (0)
  • Verified answer
    v-mengmli-msft Profile Picture
    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
    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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 739 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 343 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard