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.
2 ACCEPTED SOLUTIONS

Accepted Solutions
RandyHayes
Super User
Super User

@JR-BejeweledOne 

So, since you already have a label with the text converted date and the date in the second gallery is also in a text format, then you can set your formula to the following:

If(LookUp(GalleryHolidays.AllItems, Label7.Text = Subtitle.Text, true), Style.DayBG, White) 

 

_____________________________________________________________________________________
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.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

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

View solution in original post

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

24 REPLIES 24
RandyHayes
Super User
Super User

@JR-BejeweledOne 

What is the Items property of Gallery1?

 

_____________________________________________________________________________________
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.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

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

Is your second gallery embedded in the first?

JR-BejeweledOne
Super User
Super User

It really is just dates.

 

Sequence(If(DateDiff(varFirstDays.January, DateAdd(varDates.January, 1, Months), Days) > 36, 42, 35))



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.

No, it isn't.



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 

So it's based on Sequence, so then Value is the only column that will be available in the ThisItem.

 

Is it that you are trying to find one of those numbers in Gallery2, or is there something else that you want to 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.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

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

Try using collections as a data source instead of the gallery as a data source.

RandyHayes
Super User
Super User

@JR-BejeweledOne @Rivius 
You most certainly do NOT need a collection!!  Please only use collections for their intended purposes.

_____________________________________________________________________________________
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.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

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

That is exactly what I need to do.  

 

If the date exists in Gallery2, then the templatefill needs to be a different color.   The highlighted label is the number and it's 'Text' value is:  Day(DateAdd(varFirstDays.January, ThisItem.Value, Days))

 

GalleryCompare4.png

 

In Gallery2 the date is text.  I have tried wrapping it in DateValue and comparing, no error, but it also doesn't give me what I need.  You can see no error, but the background for any of the dates that exist and there should be 2, in this scenario are not changing color.

 

GalleryCompare5.png

 

I also added a label in Gallery2, that has the same number value as Gallery1



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 

So, since you already have a label with the text converted date and the date in the second gallery is also in a text format, then you can set your formula to the following:

If(LookUp(GalleryHolidays.AllItems, Label7.Text = Subtitle.Text, true), Style.DayBG, White) 

 

_____________________________________________________________________________________
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.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
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
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (4,349)