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 / Image collection based...
Power Apps
Answered

Image collection based on IF statement

(0) ShareShare
ReportReport
Posted on by 110

Hello,

I am a bit new to Powerapps and I have 2 questions regarding collections to store images.

I have a checklist and i need only to store the image IF the checkbox is activated.

Currently i am using the camera control and storing the image in the image control.

AOZ_0-1618858696392.png

 

Collect(ColImage,
{
File: DataCardValue36.Image, Name: TextInput3.Text,
File2: DataCardValue36_1.Image, Name2: TextInput3_1.Text,
File3: DataCardValue36_2.Image, Name3: TextInput3_2.Text,
File4: DataCardValue36_3.Image, Name4: TextInput3_3.Text,
File5: DataCardValue36_4.Image, Name5: TextInput3_4.Text,
File6: DataCardValue36_5.Image, Name6: TextInput3_5.Text,
File7: DataCardValue36_6.Image, Name7: TextInput3_6.Text,
File8: DataCardValue36_7.Image, Name8: TextInput3_7.Text,
File9: DataCardValue36_8.Image, Name9: TextInput3_8.Text,
File10: DataCardValue36_9.Image, Name10: TextInput3_9.Text
}
);

First question is how to include the IF inside the above syntax so as to store the image ONLY when the checkbox is activated.

 

My second question is regarding the image being stored - the last image always remains - how do we "initialise" this image control when the form is loaded for example?

 

Thanks,

Arshad

Categories:
I have the same question (0)
  • WarrenBelz Profile Picture
    156,327 Most Valuable Professional on at

    Hi @AOZ ,

    First question - as below

    Collect(
     ColImage,
     If(
     CheckBoxNo1.Value,
     {File: DataCardValue36.Image, Name: TextInput3.Text}
     ),
     If(
     CheckBoxNo2.Value,
     {File: DataCardValue36_1.Image, Name: TextInput3_1.Text}
     ),
     . . . . .
    );

    Assuming you clear the collection, nothing should remain - what do you men by initialise?

     

    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.

  • AOZ Profile Picture
    110 on at

    Dear @WarrenBelz 

    Thanks for the response.

    I have amended my code as follows, but i note that even if the checkbox is not activated (value is true) the previous photo taken is still stored in the collection.

    This is why i wanted to "initialise" the image controls box when the form is loaded - by initialise, i mean erase all photos which are found in the boxes previously taken because they remain. 

     


    Collect(
    ColImage,
    If(
    DataCardValue42.Value=false,

    {File: DataCardValue36.Image, Name: TextInput3.Text}
    ),

    If(
    DataCardValue43.Value=false,
    {File2: DataCardValue36_1.Image, Name2: TextInput3_1.Text}
    )
    );

  • WarrenBelz Profile Picture
    156,327 Most Valuable Professional on at

    Hi @AOZ ,

    Clearing the collection

    Clear(colImage)

    will remove anything in it. You could also reset all the toggles

    Reset(Checkbox1);
    Reset(Checkbox2);
     . . . . . 

    If you want to see images where they (line up), you would have to do this

    Collect(
     ColImage,
     If(
     CheckBoxNo1.Value,
     {File: DataCardValue36.Image, Name: TextInput3.Text},
     {File: Blank(), Name: Blank()}
     ),
     If(
     CheckBoxNo2.Value,
     {File: DataCardValue36_1.Image, Name: TextInput3_1.Text},
     {File: Blank(), Name: Blank()}
     ),
     . . . . .
    );

     

    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.

  • AOZ Profile Picture
    110 on at

    Dear @WarrenBelz 

    Thanks again.

    In fact i am looking for a way to clear the below controls (outside the collection) when the form is loaded.

    Something like when the form loads, DatacardValue36.image = Blank()

    This is however not working...all images previously taken remain in the image control.

     

    AOZ_0-1618908235758.png

     

     

     

  • Verified answer
    WarrenBelz Profile Picture
    156,327 Most Valuable Professional on at

    @AOZ ,

    The problem you have is that the controls are based on the collection and resetting the control will simply put the collection image back into it.

    You might try a Variable

    UpdateContext({varBlank:true})

    then the Image could be 

    If(
     varBlank,
     Blank(),
     Collection.Image //(whatever it is now)
    )

    You would then have to set varBlank to false when you wanted to see the images again. I am not sure why you simply do not clear the collection.

     

    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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 392 Most Valuable Professional

#2
11manish Profile Picture

11manish 181 Super User 2026 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 112 Super User 2026 Season 2

Last 30 days Overall leaderboard