cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Change Image OnSelect

Hello Everyone, 
I am trying the hole day but it seems I can not figure it out.

I have a Gallery with 7 Award Categorys. Every Award has its own Image (I have created on the start of my app)

ClearCollect(AllAward_Types,
{PrimaryId: 1, Type:"Extra-Meile",Award_Color: "#2DAAE1", Description: "The Helpful Feedback Award badge is given to the person who gave critical insight on another person's work.", Icon: 'Extra-Meile' ,Selected:false}......)

Now I have a get the Images but I want every time I click on one of them to change, I have tried to create a collection with the type of award and another image per type and then used this formula

If(ThisItem.IsSelected, LookUp(HoverIcons, Type=ThisItem.Type).Icon,ThisItem.Icon)

But it doesn't seem to work.

 

I would be grateful for an answer!

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @Anonymous ,

I am assuming Extra-Meile is a standard icon type in German. If so, using your syntax

If(
   ThisItem.IsSelected,  
   Switch(
      LookUp(
         HoverIcons, 
         Type=ThisItem.Type
      ).Icon,
      "Extra-Meile",
      Extra-Meile,
      "Save",
      Save,
      ThisItem.Icon
   )
)

and the rest would follow down (between the Save example and ThisItem.Icon)

 

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.

 

View solution in original post

3 REPLIES 3
WarrenBelz
Super User
Super User

@Anonymous ,

That is because you cannot refer to objects dynamically - if ThisItem.Type = "Save" (a String), an Icon of Icon.Type does not work - it has to be Icon.Save.

You would need to hard-code it all.

 

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.

Anonymous
Not applicable

@WarrenBelz  Thank you for your response, could you give me an example of what do you mean hardcoding all? 

and also do you mean I need to hard code them onStart?

Hi @Anonymous ,

I am assuming Extra-Meile is a standard icon type in German. If so, using your syntax

If(
   ThisItem.IsSelected,  
   Switch(
      LookUp(
         HoverIcons, 
         Type=ThisItem.Type
      ).Icon,
      "Extra-Meile",
      Extra-Meile,
      "Save",
      Save,
      ThisItem.Icon
   )
)

and the rest would follow down (between the Save example and ThisItem.Icon)

 

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.

 

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (4,033)