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

Make the Browse Screen Change Colors Depending on field

So I am creating an inventory app.  I want the browse screen to display items in a seperate color (or atleast the text) based on how much of that item is left. 

Basically if there's only 1 monitor left in our inventory I want that section to be highleted in red so I know to order more.  I also don't need it to do this for every item.  Just specific ones.  Is this possible?   I keep trying things like:

If(Quantity <= 3, RGBA(100,0,0,0), RGBA(0,0,0,0))

Obviously with different "RGBA", but you get the gist.  Is this even possible?  If not any cool suggestions?

13 REPLIES 13

@Salamander94 

Ah ha...now we see the issue.  PowerApps sees your Quantity column as a text column.

So, change your TemplateFill to the following:

If(Value(ThisItem.Quantity) <= 1, DeepPink, 
   Value(ThisItem.Quantity) <= 3, LightSalmon, 
   Value(ThisItem.Quantity) <= 10, LightSkyBlue, 
   LightGreen
)

And now you should see some colors!

 

Since you pulled this from Excel, you might want to double back on the Excel file and look at the formatting for the Quantity column.  Something is confusing PowerApps to think it is a text column.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too!

View solution in original post

You're the bomb!  It works.  Thanks again!

So I have another question about this topic.  It works perfectly fine, but not all of the items in our inventory need to be restocked.  I was wondering if it was possible to make the colors depend on two variables so not all items would be applicable to the rule? 
For example, I made a "Priority" field.  If the item will need to be restocked when low I have the priority set to "H".  I tried code such as:

If(ThisItem.Quantity = 3 and ThisItem.Priority = "H", CadetBlue, ThisItem.Quantity = 2 and ThisItem.Priority = "H", LightPink, ThisItem.Quantity <= 1 and ThisItem.Priority = "H", Salmon)

Unfortunetely this didn't seem to work.  I did make a second browse screen that filtered out just the items with "H" as the priority and then colored them accordingly.  However, it'd be awesome to just have the one browse gallerey. 

@Salamander94 

You are on the right track...just need to look over that syntax a bit AND...I thought we determined that your Quantities needed to be "Valued"...

 

If(Value(ThisItem.Quantity) = 3 && ThisItem.Priority = "H", CadetBlue, 
   Value(ThisItem.Quantity) = 2 && ThisItem.Priority = "H", LightPink, 
   Value(ThisItem.Quantity) <= 1 && ThisItem.Priority = "H", Salmon)

You can use "And" or "&&" to represent a logical "and" statement.  I picked the && in the above example.

Give that a shot.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too!

Helpful resources

Announcements
New Badges

New Solution Badges!

Check out our new profile badges recognizing authored solutions!

New Power Super Users

Congratulations!

We are excited to announce the Power Apps Super Users!

Power Apps Community Call

Power Apps Community Call: February

Did you miss the call? Check out the Power Apps Community Call here.

Microsoft Ignite

Microsoft Ignite

Join digitally, March 2–4, 2021 to explore new tech that's ready to implement. Experience the keynote in mixed reality through AltspaceVR!

Top Solution Authors
Top Kudoed Authors
Users online (23,409)