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

Add Image in Media Library to a Collection

I have a Sharepoint list with a Choice column "FF_Test" that has 4 values in it (Value1, Value2, Value3, Value4)

In PowerApps Media Library i have four images (Value1, Value2, Value3, Value4)

I am trying to create a form where the values from the Choice Column appear with the corresponding images

 

I have tried to create OnStart a collection using:

ClearCollect(colTest, AddColumns(Choices(Test.FF_Test), "Selected", false, "Image", Value));

 

...and display it in the gallery using ThisItem.Value or Text(ThisItem.Value) for the Image but it is still blank and doesn't display anything.

 

Any help or direction is greatly appreciated

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Super User III
Super User III

Re: Add Image in Media Library to a Collection

@ruslank 

I think the difficult part of what you are trying to do is match up those Choices from a Sharepoint column to an Image.  From what I can see using the Choices() function will make it difficult to do that.  Here's how I got around that problem by manually defining the Choices and their related Images.

 

Step 1:  Load your images into the media gallery.

 

img1.png

 

Step 2:  Add the following code to the OnStart property of your app

 

ClearCollect(
	OptionsCollection,
	{Value:"Value1", Image: Image1},
	{Value:"Value2", Image: Image2},
	{Value:"Value3", Image: Image3},
	{Value:"Value4", Image: Image4}
)

Step 3:  Create a new gallery.  Add an Image with the Image property ThisItem.Image.  Add a Label with the Text property ThisItem.Value.

 

img2.PNG

 

The key here is to make sure Value1, Value2, Value3, Value4 match your Choices in Sharepoint.

 

---
Please click "Accept as Solution" if my response helped to solve your issue so that others may find it more quickly. If your thought the post was helpful please give it a "Thumbs Up."

View solution in original post

4 REPLIES 4
Highlighted
Super User III
Super User III

Re: Add Image in Media Library to a Collection

@ruslank 

I think the difficult part of what you are trying to do is match up those Choices from a Sharepoint column to an Image.  From what I can see using the Choices() function will make it difficult to do that.  Here's how I got around that problem by manually defining the Choices and their related Images.

 

Step 1:  Load your images into the media gallery.

 

img1.png

 

Step 2:  Add the following code to the OnStart property of your app

 

ClearCollect(
	OptionsCollection,
	{Value:"Value1", Image: Image1},
	{Value:"Value2", Image: Image2},
	{Value:"Value3", Image: Image3},
	{Value:"Value4", Image: Image4}
)

Step 3:  Create a new gallery.  Add an Image with the Image property ThisItem.Image.  Add a Label with the Text property ThisItem.Value.

 

img2.PNG

 

The key here is to make sure Value1, Value2, Value3, Value4 match your Choices in Sharepoint.

 

---
Please click "Accept as Solution" if my response helped to solve your issue so that others may find it more quickly. If your thought the post was helpful please give it a "Thumbs Up."

View solution in original post

Highlighted
Frequent Visitor

Re: Add Image in Media Library to a Collection

thank you, @mdevaney  Not exactly what i was looking for. My goal was to avoid having to manage the data in both places: Sharepoint and PowerApps. 

 

With your solution if my values were to change, i have to update them in both places. Any solution to avoid that?

Highlighted
Super User III
Super User III

Re: Add Image in Media Library to a Collection

@ruslank 

A Choices column does not give you any option to assoicate an image so I think it is not possible to do only in Sharepoint.

 

Instead, my suggestion would be to change your Sharepoint column to single-line text and then control what choices the user has only from the app.  You could do this easily with the collection I provided in Step #2.  It might not be your ideal solution, but I do not see any other way to achieve control from only one program.

 

---

Please click "Accept as Solution" if my response helped to solve your issue so that others may find it more quickly. If your thought the post was helpful please give it a "Thumbs Up."

Highlighted
Post Patron
Post Patron

Re: Add Image in Media Library to a Collection

@mdevaney Just a quick note to say thanks -- this was really helpful for me as I was preparing for an upcoming presentation!  

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Watch Now

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 designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (5,563)