web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Conditional format on ...
Power Apps
Unanswered

Conditional format on DataCard

(0) ShareShare
ReportReport
Posted on by 265

Hello guys,

 

I know this sound basic and actually I found many topics about this but seems I still cannot make it works. 

I'm a newbie in PowerApps, and now I just want to have my DataCard in my Browse Gallery to have a certain color based on a value.

 

How exactly and where I should put the expression ?

 

So I have a BrowseGallery which contains DataCard, and lets say the DataCard I want to change its color is DataCardValue11. The column underlying it, is the Active column (which is an two options set).

 

Currently, I did, 

1. Unlock the specified DataCard

2. Go to Properties and Tab Advanced

3. Locate "Color"

4. Then add the expression, like this : If (Value(DataCardValue11.Text) = "Active", Green, Red)

 

There is an warning sign saying it is incompatible type. Is OptionSet need special care and cannot just put the text "Active" like that ? 

 

Need help.

 

Thanks,

V

 

 

 

 

Categories:
I have the same question (0)
  • mdevaney Profile Picture
    29,989 Moderator on at

    @Voltes 
    To target each row individually you will need to use the ThisItem property.  Please take a screenshot and show me your app if this doesn't work.  I'm making an assumption that VDataCardValue1 is a dropdown control (not a ComboBox).

     

    If(ThisItem.VDataCardValue1.Selected.Value= "Active", Green, Red)

     

    ---
    Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

  • Voltes Profile Picture
    265 on at

    Hi,

     

    It's not even an Edit form actually. Here is the screen looks like :

    image.png

     

    and this "Status" is an standard field every time we create Entity in CDS, so the field/data type is OptionSet

     

    Thanks

  • mdevaney Profile Picture
    29,989 Moderator on at

    @Voltes 

    I thought you were using a Gallery.  Was making a guess based on your description but you are using an Edit Form.

    Put this code in the Color property of your Card.  If .Value does not work then see what autocomplete suggests instead.

     

    If(VDataCardValue1.Selected.Value= "Active", Green, Red)

     

    ---
    Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up." 

  • Voltes Profile Picture
    265 on at

    Hi,

     

    I think the left part of condition is ok now, following your suggestion, but the right part cannot use "Active", however I'm not sure.

     

    Here is the look now :

    If (DataCardValue11.Selected.Value = "Active", Green, Red)

     

    and the error saying : "Incompatible type. We can't evaluate your formula because the values being compared in the formula aren't the same type"

    image.png

    Thanks in advance,

    V

     

     

  • mdevaney Profile Picture
    29,989 Moderator on at

    @Voltes 
    Type DataCardValue11.Selected. and see what autocomplete suggests.  Likely we are simply targeting the incorrect column. 

  • Voltes Profile Picture
    265 on at

    Hi 

     

     

  • Voltes Profile Picture
    265 on at

    Hi,

     

    I'm not sure what else I could share, since it is a standard field in CDS entity. Am I right to say every time we create an entity, we always get this "Status" field ? Below is the field looks like :

    image.png

     

    And some other property that I thought might be related.

    image.png

     

    The Column is DataCardValue11, as in my previous screen with the overall project with Tree view and all. In the entity as showing above though, it is stated as Option Set. Btw,  if I'm using [@State] like this, although it is not for the Status, once I type that, a suggestion come out for the possible value., like "Added", "All", "Deleted" and so on, just wondering why I didn't get such option with the choices of "Active" ? The [@State] seems to me like an Enum (if it is a terminology in Dynamics 365 Finance), so what is the Enum for this Status field ?

     

    Thanks,

     

     

     

     

  • mdevaney Profile Picture
    29,989 Moderator on at

    @Voltes 

    When you see this error, what column types does it say are being compared?

     

    "Incompatible type. We can't evaluate your formula because the values being compared in the formula aren't the same type"

    ---
    Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

  • Voltes Profile Picture
    265 on at

    Hi 

     

    How to know this ? 

     

    But there is something when my cursor is after the equal sign, there are suggestion what to type which is the fields of my entity.

    image.png

     

    But it is weird, I want to compare the value, why it suggest the field instead ?

     

    Thanks

     

  • Voltes Profile Picture
    265 on at

    Hello everyone,

     

    Please if anyone can give some clue or idea or anything I should check. I thought the conditional format to make the font color red/green based on some value would be easy. Never thought would be this difficult. 🙄

     

    Point to make is :

    1. I have a table / entity in CDS

    2. Along with my custom / newly added fields, this CDS has column / fields Status (which is a standard field every time we create entity, so the data type and all should be standard I supposed)

    3. In PowerApps, I create a Browse Gallery to this table from a template. So, as normal (since it is from template) it will have browse screen and Edit screen and in the Edit screen, does this Status field appeared.

    4. I just want this Status, whenever it says "Active", rather than normal "black", the font is Red, 

     

    If it is hard because probably difficult to know what I already did, can anyone advice some example how to achieve those point instead, so I can just do it from the scratch again.

     

    Thanks in advance.

     

     

     

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 765 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 343 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 272

Last 30 days Overall leaderboard