cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Pricilla
Helper IV
Helper IV

How to link date picker with calendar gallery

Hi @PowerAddict , 

 

I have a calendar gallery which is just for view, i have a date picker in a screen ,i want to link the date picker with calendar to get the result for below condition

If(date picker date = calendar date & (total hours text box value >= 8), Green, Red ), also want to add another color based on a toggle how to get this result in power apps

11 REPLIES 11
PowerAddict
Super User II
Super User II

Question - when you say date picker date = calendar date, are you suggesting that a user will select a date on the calendar gallery and on the date picker and if the two are the same (and when the number added in the text box is greater than or equal to 😎 then change the color to Green, else change it to Red? 

 

One more question - how do you want the toggle to affect the color? If you can describe it, even if that is words and not Power Apps code, I can help you out. 

 

---
If you like this reply, please give kudos (Thumbs Up). And if this solves your problem, please mark this reply as a solution by selecting Accept as Solution. This makes it easier for others to find answers to similar questions. 

 

Thanks!

Hardit Bhatia

Microsoft Business Applications MVP

Blog | Twitter | LinkedIn | Facebook | YouTube  |  Email

Hi @PowerAddict ,

 

The user will select the date only in the date picker, calendar gallery is just for view, as you can see in the below screenshot there is a color filled for today's date, similarly i want a color to be filled in all the dates based upon the total hours value & toggle operation is to indicate holiday, if its on i want a different color instead of green & red to differentiate

2020-08-27 13-02-06_PDEC Time Tracker for testing - Saved (Unpublished) - Power Apps.jpg2020-08-27 13-02-17_PDEC Time Tracker for testing - Saved (Unpublished) - Power Apps.jpg2020-08-28 12-36-06_PDEC Time Tracker - Saved (Unpublished) - Power Apps.jpg

Hi @Pricilla 

 

Thank you for the details. Without knowing the exact values, here is an expression that I think should work (replace with your field names): 

If(date picker date = calendar date & (total hours text box value >= 8), Green, If( holiday toggle, yourOtherColor, Red ))

What this will do is if the date picker date = calendar date AND if the total hours text box value > 8, then the Fill color will be Green, then if the holiday toggle is true (you can also add another condition with the AND operator if there are specific rows that you want to be filled with another color when the holiday toggle is set to true), it will change the Fill color to the other color you want, and if none of the 2 conditions are true, then it will Fill them with Red color. 

This may not be exactly the same to what you want because what happens if date picker data = calendar control AND total hours text box value >= 8 AND holiday toggle is set to true? With the above expression, it will be filled with green color. So if this is not what you want, please state all the possible conditions with your color choices and we can come up with another formula/expression. 

 

---
If you like this reply, please give kudos (Thumbs Up). And if this solves your problem, please mark this reply as a solution by selecting Accept as Solution. This makes it easier for others to find answers to similar questions. 

 

Thanks!

Hardit Bhatia

Microsoft Business Applications MVP

Blog | Twitter | LinkedIn | Facebook | YouTube  |  Email

 

@PowerAddict  thanks for the response, if holiday toggle is true then total will be zero

Hi @Pricilla 

 

I am a little confused now. Are you suggesting that depending on the date picker and toggle values, you not only want to change colors but also change certain values? Can you clearly state your requirements so we can solve this quickly. 

 

---
If you like this reply, please give kudos (Thumbs Up). And if this solves your problem, please mark this reply as a solution by selecting Accept as Solution. This makes it easier for others to find answers to similar questions. 

 

Thanks!

Hardit Bhatia

Microsoft Business Applications MVP

Blog | Twitter | LinkedIn | Facebook | YouTube  |  Email

@PowerAddict , let me put it in this way, there is a calendar which is view mode, i want the date fill in different colors based on two 3 conditions, one is when total hours is >= 8, green else red & the other is when toggle holiday is true then yellow(example), in back ground when holiday is turned on total will be zero by default. Hope its clear

Apologies for the previous message, wrong thread. Will post a reply soon. 

Hi @Pricilla 

 

Can you try this? 

If(date picker date = calendar date && (total hours text box value >= 8), Green, If(date picker data = calendar date && (total hours text box values = 0), Yellow, Red ))

This will achieve the following:

1. If date picker date is the same as calendar date and total hours is greater than 8, then it will be green

2. If date picker date is the same as calendar date and total hours  is equal to 0, then it will be yellow

3. In every other condition, it will be red

 

Let me know if there are changes to any of the above 3 points and we can adapt the formula accordingly. 

 

---
If you like this reply, please give kudos (Thumbs Up). And if this solves your problem, please mark this reply as a solution by selecting Accept as Solution. This makes it easier for others to find answers to similar questions. 

 

Thanks!

Hardit Bhatia

Microsoft Business Applications MVP

Blog | Twitter | LinkedIn | Facebook | YouTube  |  Email

 

@PowerAddict Thanks for helping me out, i tried writing the formula in the fill but it isn't working, can you please let me know where is should put this formula, the calendar in the screen is a component

 

Pricilla_0-1599214312123.png

 

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

Are Your Ready?

Test your skills now with the Cloud Skill Challenge.

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