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 / Set colour of item in ...
Power Apps
Answered

Set colour of item in gallery

(0) ShareShare
ReportReport
Posted on by 1,599 Super User 2024 Season 1

I am trying to set the colour of items in a gallery based on a click of a button that navigates me along the 4 different tabs.

 

sudosaurus_0-1692203612163.png

Essentially when I'm on the 'Claim' tab, the circle should be Yellow and when I navigate to the 'Argument' tab, the 'Claim' circle should change to Green and the 'Arguement' circle should change to Yellow and so on whilst all the other circles stay grey.


I've tried the below but that doesn't seem to work:

If(varCurrentTab=1 & Label3 = "Claim",clTheme.clYellow,clTheme.clMidGrey,
If(varCurrentTab=2) & Label3 = "Argument",clTheme.clYellow),
If(varCurrentTab=3) & Label3 = "Evidence",clTheme.clYellow,
If(varCurrentTab=4) & Label3 = "Action Plan",clTheme.clYellow)

 
For reference, I am using this fx for my tabs:

ClearCollect(
 FormItemStatus,
 {
 ID: 1,
 Page: 1,
 Label: "Claim",
 Status: "In progress"
 },
 {
 ID: 2,
 Page: 2,
 Label: "Argument",
 Status: "Not started"
 },
 {
 ID: 3,
 Page: 3,
 Label: "Evidence",
 Status: "Not started"
 },
 { ID: 4,
 Page: 4,
 Label: "Action Plan",
 Status: "Not started"
 }
);

and I'm using this fx for my status colours:

ClearCollect(
 StatusColors,
 {
 Status: "Not started",Fill: clTheme.clMidGrey,BorderColor: clTheme.clWhite,Color: clTheme.clWhite, fontFamily: "Calibri", fontColor: clTheme.clBlue
 },
 {
 Status: "In progress",Fill: clTheme.clYellow,BorderColor: clTheme.clWhite,Color: clTheme.clWhite, fontFamily: "Calibri", fontColor: clTheme.clBlue
 },
 {
 Status: "Complete",Fill: clTheme.clGreen,BorderColor: clTheme.clWhite,Color: clTheme.clWhite, fontFamily: "Calibri", fontColor: clTheme.clBlue
 }
)

Ideally I'd like to get this working on the onSelect value of my next button:

sudosaurus_2-1692203938030.png

sudosaurus_1-1692203915220.png

Would appreciate any help given! 🙂

Categories:
I have the same question (0)
  • LaurensM Profile Picture
    12,516 Moderator on at

    Hi @sudosaurus,

     

    I don't think you need custom logic dependent on the current tab and label name, since you already keep track of the status via the StatusColors collection. The Fill property of the circle should be:

     

    LookUp(StatusColors, ThisItem.Status = Status).Fill

     

    When navigating from Claims to Argument, update the status of Claims to "Complete":

     

    //OnSelect
    Patch(FormItemStatus, {ID: varCurrentTab}, {Status: "Complete"});
    Set(varCurrentTab, 1)

     

    This should result in the correct colours. Should you want to display yellow when navigating back to a completed section, add the following code to the Fill property:

     

    If(
     varCurrentTab = ThisItem.ID,
     clTheme.clYellow,
     LookUp(StatusColors, ThisItem.Status = Status).Fill
    )

     

    If this solves your question, would you be so kind as to accept it as a solution & give it a thumbs up.

    Thanks!

  • sudosaurus Profile Picture
    1,599 Super User 2024 Season 1 on at

    @LaurensM - it doesn't seem to be able to find the ID from the collection:

    sudosaurus_0-1692217983017.png

     

  • Verified answer
    LaurensM Profile Picture
    12,516 Moderator on at

    @sudosaurus my apologies, no idea how I missed that error during proofreading. 😅

     

    Please try:

    Patch(FormItemStatus, {ID: varCurrentTab}, {Status: "Complete"});
    
    //or
    Patch(FormItemStatus, LookUp(FormItemStatus, ID = varCurrentTab), {Status: "Complete"});

     

    I will adjust my initial comment as well.

  • sudosaurus Profile Picture
    1,599 Super User 2024 Season 1 on at

    @LaurensM - so that mostly works - however, the current tab is not showing as yellow.
    When on the Claim tab (1) it will default to yellow as per the above code and all the other ones are midGrey until they become active tab. 

     

    sudosaurus_0-1692218623169.png

     

  • sudosaurus Profile Picture
    1,599 Super User 2024 Season 1 on at

    @LaurensM - nevermind I just noticed this bit you posted! (sorted!)

     

    If(
     varCurrentTab = ThisItem.ID,
     clTheme.clYellow,
     LookUp(StatusColors, ThisItem.Status = Status).Fill
    )
  • sudosaurus Profile Picture
    1,599 Super User 2024 Season 1 on at

    @LaurensM - thanks for that.
    If I'm saving form to a SharePoint list and then go back in to view the item will it save the colours for the various circles to show where the item is up to?

  • LaurensM Profile Picture
    12,516 Moderator on at

    @sudosaurus with the hardcoded FormItemStatus it will always reset the tab list.

     

    In order to save the progress, you would need to keep track of the status within your SharePoint list and reflect this in your FormItemStatus collection. You could create text status columns for each tab in SharePoint or use one number column to keep track of the currently in progress ID. (e.g. value of 3 means that step 3 is currently in progress)

     

    That column will then be leveraged to dynamically fill the status column in your collection (via If() statements if you use the number column or RecordReference.ColumnName if you use separate text columns for each step). No changes required to the Fill logic.

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 600

#2
WarrenBelz Profile Picture

WarrenBelz 478 Most Valuable Professional

#3
Valantis Profile Picture

Valantis 322

Last 30 days Overall leaderboard