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 / Change data card borde...
Power Apps
Unanswered

Change data card border color when an item is changed

(0) ShareShare
ReportReport
Posted on by

Hello,

 

I am using a technique I saw on a Reza video to highlight form fields that have been changed. I really like the effect, but I've only been able to get it to work on Text fields.

 

Border Color formula (Company Text Field example - works fine):

If(ThisItem.Company <> valCompanyES.Text, Orange, RGBA(32, 54, 71, 1))

 

I've tried this formula for the html text field without success:

If(ThisItem.'Shipment Description' <> txtShipDescEdit.HtmlText, Orange, RGBA(32, 54, 71, 1))

 

I tried this formula for the Shipping Method dropdown. I don't get any red squigglies, but it doesn't work and I get a message that reads "This formula uses scope, which is not presently supported for evaluation". Not sure what the work around is.

If(ThisItem.'Shipping Method'.Value <> varRecord.'Shipping Method'.Value, Orange, RGBA(32, 54, 71, 1))

I also have a combo box in the form, but I figured I should start with these questions first. Thanks in advance for your help.

BorderColorSS.png

 

Categories:
I have the same question (0)
  • Ramole Profile Picture
    Super User 2024 Season 1 on at

    Hello @tagustin2020 

     

    What is the code you're having the issue, can you point please 

     

     

     

  • rubin_boer Profile Picture
    4,841 Super User 2024 Season 1 on at

    hi @tagustin2020 try evaluating and set the color in the html text, something

     

    "<font color=" & If(ThisItem.'Shipment Description' <> txtShipDescEdit.HtmlText,"orange","black") &"> your text will be here. </font>"

    hope it helps

  • tagustin2020 Profile Picture
    on at

    @rubin_boer 

     

    Hello Rubin,

     

    Thank you for the quick response. I'm looking to change the border color of html text controls and dropdowns, not the text as seen in the Street Address form row above. Is that possible?

     

    Kind regards,

    Teresa

  • tagustin2020 Profile Picture
    on at

    @Ramole 

     

    Hello Ramole,

     

    What I was trying to explain in my post is that the border color formula that works for regular form text data cards, does not work for htmltext and dropdown type data cards. I'm looking to see if anyone knows how to adjust the border color formulas for these types of fields. 

     

    Thank you,

    Teresa

     

    Thank you for the reply. 

  • rubin_boer Profile Picture
    4,841 Super User 2024 Season 1 on at

    hi @tagustin2020 

     

    Just did a test on my side and it evaluates and set the border color with htmltext as is and wrapping it in plaintext which. it works for the html text and dropdowns.

    rubin_boer_0-1627936054003.png

     

    what is the result of the condition when you highlight over it, do you get a true or false or is this when you get the message?

     

     

     

  • tagustin2020 Profile Picture
    on at

    @rubin_boer 

     

    Hi Rubin,

     

    Thanks for the suggestion. I don't have a label to compare against so I'm not sure this is going to work for me. Any other ideas of what might work?

     

    Teresa

  • Verified answer
    RandyHayes Profile Picture
    76,297 Super User 2024 Season 1 on at

    @tagustin2020 

    In general, your formulas for showing changes should be the following (using the border color as you're using):

    If(Parent.Default <> Parent.Update, Orange, RGBA(32, 54, 71, 1))

    This will work with simple columns (Text, Number, Date, etc)

     

    For complex types (Choices, person, etc.) the formula needs to not reference the Default property (as the Default property does not have a defined schema type and thus PowerApps will not be able to reference as you like).  Plus, PowerApps cannot compare a record to a record.

    The same goes for the Update property...it can have any schema to it, but PowerApps will not recognize it in your formulas.

     

    So, for a Choice column, you would need to reference the underlying column value and then reference the SAME control that your Update property references.  In other words, we need to shift down a level before both the Default and the Update properties to get the values.

     

    You would need to alter your formula to the following:

    If(ThisItem.'Shipping Method'.Value <> yourShippingMethodDropdown.Selected.Value, Orange, RGBA(32, 54, 71, 1))

     

    As for the RichText editor border color...the text in that is editor will be in Html format and the value in your underlying column will be as well (assuming you are passing the HTML to the underlying column and not using a PlainText function somewhere).  So, the above formula for the simple text fields should do what you need:

    If(Parent.Default <> Parent.Update, Orange, RGBA(32, 54, 71, 1))

     

    As for the "This formula uses scope, which is not presently supported for evaluation".  This is not an error.  This is the formula editor telling you that it cannot evaluate a formula that has a "ThisItem" object in it.  This is completely normal.

  • tagustin2020 Profile Picture
    on at

    @RandyHayes 

     

    Hi Randy,

     

    I got the dropdown fields working with your formula suggestions, thanks! In regards to the Text fields, there was no Default or Update properties available in Intellisense. I tried LastSubmit as an option in case that would work and Updates for the second one, but I got an "Incompatible types" message.

     

    IncompatibleSS.png

     

    I ended up reverting back to the formula inserted below from the Reza video which seems to be doing the trick for Text fields. Per your note, I assume it will also work for date and numeric type fields as well. I know you are busy so no need to troubleshoot further. Thanks again! Teresa

     

    If(ThisItem.'Street Address' <> valAddressES.Text, Orange, RGBA(32, 54, 71, 1))

     

     

     

     

     

     

     

  • RandyHayes Profile Picture
    76,297 Super User 2024 Season 1 on at

    @tagustin2020 

    If you were not getting a Defaults or an Update property option, then you were not on a control in the datacard.

    You had mentioned that you wanted to have the Border color of your control in the data card to be different based on changes...did I get that wrong?

     

  • tagustin2020 Profile Picture
    on at

    @RandyHayes 

     

    Hi Randy,

     

    I understand where the disconnect is now. In Reza's tutorial, he changes the BorderColor property of the data card itself, not the value field within the data card. It still has the effect of putting an orange border around the value field. I like your formula and it is working perfectly now that I have it in the right place. My follow-up question would be whether there is a way to make the BorderColor red if they enter erroneous data. It's not critical since I am already surfacing an error message below the field if they get something wrong, but I was just wondering if there is a way to reinforce that with a red border instead of orange in those instances. In other words, if they make a change that doesn't violate any rules the border is orange, but if they introduce an error in the data entry while making a change, have the border be red and then turn back to orange once they have corrected the field entry.

     

    Thanks,

    Teresa

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 796 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 327 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard