cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
FacundoGorla
Level 8

Problem comparing Dates

Hi! I'm using an app to know if I have an appointment on my calendar.

 

I used a gallery to get all the appointments and I'm even able to filter them by month and location wich is great.

 

Now the problem starts when I try to compare dates.

 

Ideally I have X amount of squares that set their fill color to red or green if I have the day free or not.

So I used this:

If(DateValue("5/" & Meses.SelectedText.Value & "/2019") in Concat(Gallery2.AllItems.Label3;Text(Label3);", ") ;Red ;Green )

The thing is, I had to use text since I need to have ALL the dates of X month and X location concatenated in a single record to be able to compare. The problem is that 5/10/2019 is in 15/10/2019 so it gives me a "false" true result.

 

If I try to use date values and not text I won't work either since I'm using the start property of the appointment to compare to a date and the start one has hours,minutes and seconds wich doesn't match with the manual date I put in. 

 

If I would be able to make text compare char by char I think that it will work, or if I'm able to save dates without time stamps.

 

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Problem comparing Dates

Hi @FacundoGorla ,

Could you please share a bit more about your scenario?

 

Based on the needs that you mentioned, I afraid that the date text string value could not achieve your needs. I have made a test on my side, please consider take a try with the following workaround:

If(
DateValue("5/" & Meses.SelectedText.Value & "/2019") in ForAll(Gallery2.AllItems; DateValue(Label3.Text)); /* <-- date value comparison */
Red;
Green
)

Please consider take a try with above solution, then check if the issue is solved.

 

More details about the ForAll function, please check the following article:

ForAll function

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
cds
Level 8

Re: Problem comparing Dates

try exactin

Community Support Team
Community Support Team

Re: Problem comparing Dates

Hi @FacundoGorla ,

Could you please share a bit more about your scenario?

 

Based on the needs that you mentioned, I afraid that the date text string value could not achieve your needs. I have made a test on my side, please consider take a try with the following workaround:

If(
DateValue("5/" & Meses.SelectedText.Value & "/2019") in ForAll(Gallery2.AllItems; DateValue(Label3.Text)); /* <-- date value comparison */
Red;
Green
)

Please consider take a try with above solution, then check if the issue is solved.

 

More details about the ForAll function, please check the following article:

ForAll function

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

FacundoGorla
Level 8

Re: Problem comparing Dates

Thanks for the reply. I already tried with exactin with no luck, then read that the only difference between exactin and in is that the first checks for caps in letters. So no use here.

 

Tried ForAll since is the closest thing to a foreach we have, will try again with your code and let you know what happens.

 

Plz tell me what else you need to know about the scenario.

FacundoGorla
Level 8

Re: Problem comparing Dates

OMG IT WORKED! Thank you so much! know ti checks the values one by one. 

Tried using ForAll before but I see it as a way to change column values.

Will use it more often thanks to your example.

Helpful resources

Announcements
thirdimage

Power Apps Super User Class of 2020

Check it out!

thirdimage

Power Apps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

SecondImage

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

Top Solution Authors
Top Kudoed Authors (Last 30 Days)
Users online (5,971)