Hi all
I would like to change the container fill color based on the label text that contains an email address using the "in" function also like to use a switch function how could I use both for the fill properties for container?
code currently
Switch(
true,
DateDiff(
Today(),
DatePicker1
) < 6,
Color.DarkRed,
DateDiff(
Today(),
DatePicker1
) > 6,
Color.DarkGreen,
DateDiff(
Today(),
DatePicker1
) = 6,
Color.DarkGreen
)
Thank you
Amazing!!! just what I needed
just did a little tweak
thank you so much!!!
Hi @moerah,
Thank you for the additional info! The code below will first check whether that particular line contains a valid email format, if not then we go through the day colors. If I understand it correctly, a filled in email has priority over the date difference check.
If(
//Check whether the Text Input contains a valid email
IsMatch(
//Change to the correct control
TextInput1.Text,
"^([a-zA-Z0-9_.-])+@(([a-zA-Z0-9-])+\.)+([a-zA-Z0-9]{2,4})+$"
),
Color.Green,
//If not, go through the DateDiff logic
DateDiff(Today(), DatePicker1.SelectedDate) < 5,
Color.Red,
DateDiff(Today(), DatePicker1.SelectedDate) > 10,
Color.Green,
//Else (between 5 and 10 days)
Color.Orange
)
If this solves your question, would you be so kind as to accept it as a solution & give it a thumbs up.
Thanks!
thanks for the reply and tip
goal is to have the user input an email address which then changes the colour of the container fill to green while having the switch function sort of like concatenate.
separate note:
how can i have 3 changes of color e.g
<5 days its red
between 5 and 10 its orange
>10 its green
thank you
Hi @moerah, 😊
Your current code can be shortened to:
If(
DateDiff(Today(), DatePicker1.SelectedDate) < 6,
Color.DarkRed,
Color.DarkGreen
)
In order to extend the code with the email label, would it be possible to provide some additional info on what you would like to achieve?
Thanks!
WarrenBelz
791
Most Valuable Professional
MS.Ragavendar
410
Super User 2025 Season 2
mmbr1606
275
Super User 2025 Season 2