cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
JR-BejeweledOne
Super User
Super User

Gallery Template fill based on value in 2nd gallery

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.

 

GalleryCompare3.png

 

GalleryCompare1.pngGalleryCompare2.png

 

Would appreciate suggestions and recommendations.



If you like this post, give it a Thumbs up. If it answered your question, Mark it as a Solution to enable other users find it.
23 REPLIES 23
JR-BejeweledOne
Super User
Super User

Got it!

 

Even though Gallery2.Date was showing as a Date, it wasn't comparing that way.  This works.

 

GalleryCompare11.png



If you like this post, give it a Thumbs up. If it answered your question, Mark it as a Solution to enable other users find it.

View solution in original post

RandyHayes
Super User
Super User

@JR-BejeweledOne 

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.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

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.



If you like this post, give it a Thumbs up. If it answered your question, Mark it as a Solution to enable other users find it.
RandyHayes
Super User
Super User

@JR-BejeweledOne 

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.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Users online (1,426)