I need to set the template fill of a gallery if the date exists in a 2nd gallery.
Gallery1 - Dates
Title - Number
Subtitle - Text
Label7 - Number
Gallery2 - (Vertical Blank Flexible Height) Items
LabelDate - Text
LabelHoliday - Text
If Gallery1 Subtitle (text date) is in Gallery2 LabelDate (any item), then I need the template fill to be a color other than white.
In trying to do this, the only comparison option I have in Gallery1 is ThisItem.Value. I can't select one of the controls inside the gallery item. ThisItem.Value evaluates to a number but it won't allow me to use the = operator to compare to the number field inside gallery2.
Would appreciate suggestions and recommendations.
Solved! Go to Solution.
Even though Gallery2.Date was showing as a Date, it wasn't comparing that way. This works.
So from your last formula I had assumed that Date was the name of the label in your Gallery. Looking back, I see that perhaps it is called LabelDate
Subtitle2 is a label...it has a Text value. It doesn't matter what is in the text, it is Text! If you have "Hi" in the label, it is Text, if you have 1 in the label, it is text, if you have 5/12/2021 in the label...it is Text.
So what the label has plays no part in conversion.
What seemed to be at play was that Date is a column in the Items source of your Gallery (and obviously in a text format). The point though is that your label has the converted date to text - I was just referencing the wrong one.
Although your formula might work, you're actually producing more overhead to the app than necessary. You've already gone through the conversion of the Date to Text in the Gallery 2 label. So, with your formula, you are just doing it again.
So, your formula should really be:
If(LookUp(GalleryHolidays.AllItems, LabelDate.Text = Subtitle2.Text, true), Style.DayBG, White)
With the above, there is no additional duplicated overhead of date conversion.
Sorry, neglected to mention that I removed the DateValue conversion in Gallery2 and just left it at ThisItem.Date. I had added it early on when I was trying different things to compare. I realized I didn't need it once I had to convert it in the formula.
Yes, but the fact that you have a label that has a Date value (ThisItem.Date) as its Text property means that PowerApps is already going to convert it to the proper formatted date according to your regional information....so there was no other conversion needed. Again, just a Text to Text compare.
Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.
Register today for two amazing days of learning, featuring intensive learning sessions across multiple tracks, led by engaging and dynamic experts.
The European SharePoint Conference returns live and in-person November 28-December 1 with 4 Microsoft Keynotes, 9 Tutorials, and 120 Sessions.
We are excited to announce a new way to share your ideas for Power Apps!