Hi all,
I have a button that takes me to a gallery if an item is out of date. I want to change the colour of the button if there is an out of date item versus no item but I can't get my code to work, I have put this in the color field of my button:
If(ThisItem.'BestBeforeDate' >Today() +30, Green,Red)
Can anyone tell me what I am doing wrong?
Thanks,
Solved! Go to Solution.
Hi @JL6,
Then you should tell me how you define this record? For example, this record is selected in the gallery, then you could find the BestBeforeDate from this record using the following formula:
If(Gallery1.Selected.BestBeforeDate >Today() +30, Green,Red)
The key to this issue is to find the record including the BestBeforeDate you want to compare with the Today()+30
Hi!
I think this is just a syntax thing, like when you do maths and leave a bracket out so its taking the comparison and then adding 30 to that. Try instead to use this 🙂
If(ThisItem.'BestBeforeDate' > (Today() +30), Green,Red)
@iAm_ManCat |
Please 'Mark as Solution' if someone's post answered your question and always 'Thumbs Up' the posts you like or that helped you! |
Thanks! |
Hi @JL6,
Do you want to fill the Button with the needed color?
Actually, if you want to fill the Button with color, you should set the Fill property of the button:
If(ThisItem.'BestBeforeDate' >Today() +30, Green,Red)
Thanks, I tried that but Thisitem. is not recognized when I try that.
Hi @JL6,
Could you please tell me that where do you inset this button, within a gallery?
Actually, only if the control exists within the Gallery or Form, you could reference to the ThisItem parameter to invoke the field value from the current record.
If you have this button outside of the Gallery of form, you should find out the date of the selected record and replace the ThisItem.BestBeforeDate
Yes, it is outside of the gallery.
Hi @JL6,
Then you should tell me how you define this record? For example, this record is selected in the gallery, then you could find the BestBeforeDate from this record using the following formula:
If(Gallery1.Selected.BestBeforeDate >Today() +30, Green,Red)
The key to this issue is to find the record including the BestBeforeDate you want to compare with the Today()+30
Thank you, that worked once I referenced the gallery!
The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.
This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.
User | Count |
---|---|
191 | |
45 | |
43 | |
38 | |
35 |
User | Count |
---|---|
261 | |
83 | |
81 | |
70 | |
69 |