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 / Different colors of te...
Power Apps
Unanswered

Different colors of text depending if gallery is empty or not

(0) ShareShare
ReportReport
Posted on by 31

Hi!

I am working on a app looking like below.

 

benyie_0-1661179625304.png

The three grey boxes are different insurance types.

If you click on one insurance type (it becomes blue) and a new gallery appears below where you can choose different brokers under the chosen insurance.

I want to make the text red on the chosen insurance if the gallery of brokers is empty.

 

In the Color field I have written:

 

ForAll( Filter(cInsuranceType2; RemovedSplit=false) As Insu;
If(CountRows( Filter(cInsuranceTypeSplit_BrokerSplit_New; InsuranceTypeId = Insu.InsuranceTypeId)) = 0;
Red;Black))
 
But this doesn't work, because it's complaining about not returning a color type.
Which I think I do?
 
Filter(cInsuranceType2; RemovedSplit=false) --- All Insurance types boxes that the user has chosen
cInsuranceTypeSplit_BrokerSplit_New  ----- Collection of brokers 
cInsuranceType2 and cInsuranceTypeSplit_BrokerSplit_New share the column InsuranceTypeId to know which Insurance is chosen by the user.
Categories:
  • PowerRanger Profile Picture
    3,458 Super User 2024 Season 1 on at

    @benyie So the Gallery which appears is already connected to the correct list, right? So either it will show records (if they exists) or not. 

     

    What you could do for the Color Property is something like this:

    If(CountRows(<name_of_your_gallery>.AllItems) = 0, Red,Black)

     

    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.

  • BrianS Profile Picture
    2,407 Super User 2024 Season 1 on at

    I think it's complaining about the ForAll, which is misplaced. I'm not sure I'm totally following how yo are doing the gallery, but if you have a Filter in the OnSelect of the boxes that creates a collection and then use that to fill your gallery you could use IsEmpty(collection). You could probably also use the CountRows on the gallery without a collection. But the ForAll needs to be in one of the OnSelect actions, not a Color attribute

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

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 397 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 354

#3
WarrenBelz Profile Picture

WarrenBelz 232 Most Valuable Professional

Last 30 days Overall leaderboard