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 III
Super User III

@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.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

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

23 REPLIES 23
RandyHayes
Super User III
Super User III

@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.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes
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 III
Super User III

@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.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes
Rivius
Resolver III
Resolver III

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

RandyHayes
Super User III
Super User III

@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.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

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 III
Super User III

@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.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

View solution in original post

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Top Solution Authors
Top Kudoed Authors
Users online (65,128)