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 / Conditional formatting
Power Apps
Unanswered

Conditional formatting

(1) ShareShare
ReportReport
Posted on by 726

I have a text field that i would like to add some conditional formatting, It needs to be formatted for a sort code, xx-xx-xx 

for example 12-05-55

 

How can i do this? 

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

    Hi @amyharkus86 ,
    You can try something like below:
    With({varT:"123456"},Concatenate(Left(varT,2),"-",Mid(varT,3,2),"-",Right(varT,2)))

  • amyharkus86 Profile Picture
    726 on at

    Putting the above as the default on the text input field, only works if the sort code number is 123456, this is not always the case, it would be ##-##-## 

     

  • NandiniBhagya20 Profile Picture
    4,667 Super User 2024 Season 1 on at

    Hi @amyharkus86 ,
    If you are using a gallery, you can replace the hardcoded text with dynamic content like below - 

    With({varT: ThisItem.ColumnName},Concatenate(Left(varT,2),"-",Mid(varT,3,2),"-",Right(varT,2)))
    And when the value is blank you can add a condition - 
    If(IsBlank(ThisItem.ColumnName, "##-##-##", With({varT: ThisItem.ColumnName},Concatenate(Left(varT,2),"-",Mid(varT,3,2),"-",Right(varT,2))))

  • amyharkus86 Profile Picture
    726 on at

    @NandiniBhagya20 can it only be done in gallery? i was using EditForm.

  • iAm_ManCat Profile Picture
    18,256 Most Valuable Professional on at

    Matthew Devaney has a good post covering input masking here:

    Power Apps Phone Number Formatting In A Form (Input Mask) (matthewdevaney.com)

  • NandiniBhagya20 Profile Picture
    4,667 Super User 2024 Season 1 on at

    Hi @amyharkus86 ,
    You can do this in edit form too. You can add a button that will format the text and on click of the button:
    UpdateContext({varText:With({varT:DataCardValue1.Text},Concatenate(Left(varT,2),"-",Mid(varT,3,2),"-",Right(varT,2)))})
    Set Default property of DataCardValue1 to 

    If(Form1.Mode=FormMode.New,varText,Parent.Default)
    You can also add validation and check if the text is in proper format by using IsMatch function -
    If(IsMatch(DataCardValue1.Text, "\d{2}-\d{2}-\d{2}" ),SubmitForm(Form1),false)

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

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 421 Most Valuable Professional

#2
11manish Profile Picture

11manish 153 Super User 2026 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 116 Super User 2026 Season 2

Last 30 days Overall leaderboard