cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Uthhra
Helper III
Helper III

PowerApps Gallery

Hi all,

I am working with PowerApps dashboard which has a gallery. My Data source is SharePoint. My gallery calculates the RAG Color for all the fields and displays it (eg, Time, financial, efficiency are the labels and the respective fields have RAG colors(red, green, amber). Time category has two values to be compared(schedule & commitment). If prjmethod.text ="agile" commitment rag must be viewed in gallery or else schedule rag must be viewed in gallery. This prjmethod differs for every project. Is there any way to change the rag color based on the prjmethod condition.

Any help would be greatly appreciated.

15 REPLIES 15
phipps0218
Super User
Super User

Yes, in the color property of the label (any field) add an IF statement, for example:

 

If(prjmethod.text ="agile", Green, Blue)

 

Please Accept as Solution if it solves your question. Or just give it a Thumbs Up if it is helpful as can help others.

LinkedIn: https://www.linkedin.com/in/charlie-phipps-%F0%9F%91%A8%E2%80%8D%F0%9F%92%BB-91338715b/
Subscribe to my YouTube: https://www.youtube.com/channel/UChmFBGU1YKIU91sNMQ7buGg
Twitter: https://twitter.com/phipps0218

Uthhra
Helper III
Helper III

I have written this on the fill property of circle:

If(
StartsWith(projmethodlbl.Text, "^Agile") && EndsWith(prjcontlbl.Text, "T & M"),

If(
ThisItem.Commit = "Red",
Red,
ThisItem.Commit = "Amber",
Orange,
ThisItem.Commit = "Green",
Green
),

If(
ThisItem.SCHEDULE = "Red",
Red,
ThisItem.SCHEDULE = "Amber",
Orange,
ThisItem.SCHEDULE = "Green",
Green
))

But its working only for the first condition

What should happen if Schedule and Commit are different?

phipps0218
Super User
Super User

 

 

If(
StartsWith(projmethodlbl.Text, "^Agile") && EndsWith(prjcontlbl.Text, "T & M"),
Switch(
ThisItem.Commit, "Red", Red, "Amber", Orange, "Green", Green
),
Switch(
ThisItem.SCHEDULE, "Red", Red, "Amber", Orange, "Green", Green
))

Firstly change the IF statements for a Switch. If Schedule and Commit are different what should the fill colour be?

 

Uthhra
Helper III
Helper III

Its different only. Based on the projmethod.Text value(agile = commitment & traditional =schedule) the respective rag must be displayed in gallery.

@Uthhra what result does this give you?

If I use switch statement I am getting an error "Switch has invalid arguments", Expected color value.

This is how my gallery will look like. Based on condition the rag color is displayed

phipps0218
Super User
Super User

@Uthhra, What is the original error with the original code?

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 (3,053)