cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
mmattar
Level: Powered On

Comparing (< , >) Multiple Date/Times

Hello all,

 

I have a case where i am trying to compare multiple Date/Time cards against one another. Conditions:

        Created Date/time card has to be less than all the date times under it, Received has to be less than acknowledged. (because you can not recieve an item before it being created) etc.. , anyone know how this can be done correctly.

 

thanks

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Comparing (< , >) Multiple Date/Times

Hi @mmattar ,

Could you please share a bit more about your scenario?

Do you want to compare the multiple Date/time cards value within your app?

 

Based on the needs that you mentioned, I have made a test on my side, please take a try with the following workaround:8.JPG

9.JPG

If you want the Created Date/time card has to be less than all the date times under it:

(CreatedTimeDatePicker.SelectedDate + Time(Value(CreatedTimeHourBox.Selected.Value), Value(CreatedTimeMinuteBox.Selected.Value), Value(CreatedTimeSecondBox.Selected.Value))) < (ReceivedItemDatePicker.SelectedDate + Time(Value(ReceivedItemHourBox.Selected.Value), Value(ReceivedItemMinuteBox.Selected.Value), Value(ReceivedItemSecondBox.Selected.Value))) &&
(CreatedTimeDatePicker.SelectedDate + Time(Value(CreatedTimeHourBox.Selected.Value), Value(CreatedTimeMinuteBox.Selected.Value), Value(CreatedTimeSecondBox.Selected.Value))) < (AcknowledgedItemDatePicker.SelectedDate + Time(Value(AcknowledgedItemHourBox.Selected.Value), Value(AcknowledgedItemMinuteBox.Selected.Value), Value(AcknowledgedItemSecondBox.Selected.Value)))

or

Value(Text(CreatedTimeDatePicker.SelectedDate + Time(Value(CreatedTimeHourBox.Selected.Value), Value(CreatedTimeMinuteBox.Selected.Value), Value(CreatedTimeSecondBox.Selected.Value)), "[$-en-US]yyyymmddHHmmss")) < Value(Text(ReceivedItemDatePicker.SelectedDate + Time(Value(ReceivedItemHourBox.Selected.Value), Value(ReceivedItemMinuteBox.Selected.Value), Value(ReceivedItemSecondBox.Selected.Value)), "[$-en-US]yyyymmddHHmmss")) &&
Value(Text(CreatedTimeDatePicker.SelectedDate + Time(Value(CreatedTimeHourBox.Selected.Value), Value(CreatedTimeMinuteBox.Selected.Value), Value(CreatedTimeSecondBox.Selected.Value)), "[$-en-US]yyyymmddHHmmss")) < Value(Text(AcknowledgedItemDatePicker.SelectedDate + Time(Value(AcknowledgedItemHourBox.Selected.Value), Value(AcknowledgedItemMinuteBox.Selected.Value), Value(AcknowledgedItemSecondBox.Selected.Value)),"[$-en-US]yyyymmddHHmmss"))

If you want the Received Item Date/time card to be less than acknowledged item, please take a try with the following formula:

(ReceivedItemDatePicker.SelectedDate + Time(Value(ReceivedItemHourBox.Selected.Value), Value(ReceivedItemMinuteBox.Selected.Value), Value(ReceivedItemSecondBox.Selected.Value))) < (AcknowledgedItemDatePicker.SelectedDate + Time(Value(AcknowledgedItemHourBox.Selected.Value), Value(AcknowledgedItemMinuteBox.Selected.Value), Value(AcknowledgedItemSecondBox.Selected.Value)))

Or

Value(Text(ReceivedItemDatePicker.SelectedDate + Time(Value(ReceivedItemHourBox.Selected.Value), Value(ReceivedItemMinuteBox.Selected.Value), Value(ReceivedItemSecondBox.Selected.Value)), "[$-en-US]yyyymmddHHmmss")) < Value(Text(AcknowledgedItemDatePicker.SelectedDate + Time(Value(AcknowledgedItemHourBox.Selected.Value), Value(AcknowledgedItemMinuteBox.Selected.Value), Value(AcknowledgedItemSecondBox.Selected.Value)),"[$-en-US]yyyymmddHHmmss"))

 

If you want to check if the Created Date/time card has to be less than all the date times under it, or Received has to be less than acknowledged item, you could consider put above formula within a If function. e.g.

If(
    (CreatedTimeDatePicker.SelectedDate + Time(Value(CreatedTimeHourBox.Selected.Value), Value(CreatedTimeMinuteBox.Selected.Value), Value(CreatedTimeSecondBox.Selected.Value))) < (ReceivedItemDatePicker.SelectedDate + Time(Value(ReceivedItemHourBox.Selected.Value), Value(ReceivedItemMinuteBox.Selected.Value), Value(ReceivedItemSecondBox.Selected.Value))) &&
(CreatedTimeDatePicker.SelectedDate + Time(Value(CreatedTimeHourBox.Selected.Value), Value(CreatedTimeMinuteBox.Selected.Value), Value(CreatedTimeSecondBox.Selected.Value))) < (AcknowledgedItemDatePicker.SelectedDate + Time(Value(AcknowledgedItemHourBox.Selected.Value), Value(AcknowledgedItemMinuteBox.Selected.Value), Value(AcknowledgedItemSecondBox.Selected.Value))),
"Created Date/time card is less than all the date times under it",
"Created Date/time card is not less than all the date times under it" )

Or

If(
   Value(Text(CreatedTimeDatePicker.SelectedDate + Time(Value(CreatedTimeHourBox.Selected.Value), Value(CreatedTimeMinuteBox.Selected.Value), Value(CreatedTimeSecondBox.Selected.Value)), "[$-en-US]yyyymmddHHmmss")) < Value(Text(ReceivedItemDatePicker.SelectedDate + Time(Value(ReceivedItemHourBox.Selected.Value), Value(ReceivedItemMinuteBox.Selected.Value), Value(ReceivedItemSecondBox.Selected.Value)), "[$-en-US]yyyymmddHHmmss")) &&
Value(Text(CreatedTimeDatePicker.SelectedDate + Time(Value(CreatedTimeHourBox.Selected.Value), Value(CreatedTimeMinuteBox.Selected.Value), Value(CreatedTimeSecondBox.Selected.Value)), "[$-en-US]yyyymmddHHmmss")) < Value(Text(AcknowledgedItemDatePicker.SelectedDate + Time(Value(AcknowledgedItemHourBox.Selected.Value), Value(AcknowledgedItemMinuteBox.Selected.Value), Value(AcknowledgedItemSecondBox.Selected.Value)),"[$-en-US]yyyymmddHHmmss")),
"Created Date/time card is less than all the date times under it",
"Created Date/time card is not less than all the date times under it" )

...

 

Please consider take a try with above solution, then check if the issue is solved. Please also check the sample app I provided below for more details.

 

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.
2 REPLIES 2
Super User
Super User

Re: Comparing (< , >) Multiple Date/Times

Hi @mmattar 

 

You cannot restrict the users to select dates from a range in the date pickers, as a workaround you can show error message when the dates are not appropriate.
 
For doing so, you can add labels and set their "visible" property as:
If(DateTimeValue(Text(DatePicker1_1.SelectedDate&" "&Dropdown2_1.Selected.Value&":"&Dropdown3_1.Selected.Value&":"&Dropdown3.Selected.Value)) < DateTimeValue(Text(DatePicker1.SelectedDate&" "&Dropdown1.Selected.Value&":"&Dropdown2.Selected.Value&":"&Dropdown3.Selected.Value)), true,false)
Here, left argument of comparison is the date calculated from the second row datepickers and dropdown while right argument is calculated using first row controls.MicrosoftTeams-image (180).png

 

Hope this Helps!
 
If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!
Community Support Team
Community Support Team

Re: Comparing (< , >) Multiple Date/Times

Hi @mmattar ,

Could you please share a bit more about your scenario?

Do you want to compare the multiple Date/time cards value within your app?

 

Based on the needs that you mentioned, I have made a test on my side, please take a try with the following workaround:8.JPG

9.JPG

If you want the Created Date/time card has to be less than all the date times under it:

(CreatedTimeDatePicker.SelectedDate + Time(Value(CreatedTimeHourBox.Selected.Value), Value(CreatedTimeMinuteBox.Selected.Value), Value(CreatedTimeSecondBox.Selected.Value))) < (ReceivedItemDatePicker.SelectedDate + Time(Value(ReceivedItemHourBox.Selected.Value), Value(ReceivedItemMinuteBox.Selected.Value), Value(ReceivedItemSecondBox.Selected.Value))) &&
(CreatedTimeDatePicker.SelectedDate + Time(Value(CreatedTimeHourBox.Selected.Value), Value(CreatedTimeMinuteBox.Selected.Value), Value(CreatedTimeSecondBox.Selected.Value))) < (AcknowledgedItemDatePicker.SelectedDate + Time(Value(AcknowledgedItemHourBox.Selected.Value), Value(AcknowledgedItemMinuteBox.Selected.Value), Value(AcknowledgedItemSecondBox.Selected.Value)))

or

Value(Text(CreatedTimeDatePicker.SelectedDate + Time(Value(CreatedTimeHourBox.Selected.Value), Value(CreatedTimeMinuteBox.Selected.Value), Value(CreatedTimeSecondBox.Selected.Value)), "[$-en-US]yyyymmddHHmmss")) < Value(Text(ReceivedItemDatePicker.SelectedDate + Time(Value(ReceivedItemHourBox.Selected.Value), Value(ReceivedItemMinuteBox.Selected.Value), Value(ReceivedItemSecondBox.Selected.Value)), "[$-en-US]yyyymmddHHmmss")) &&
Value(Text(CreatedTimeDatePicker.SelectedDate + Time(Value(CreatedTimeHourBox.Selected.Value), Value(CreatedTimeMinuteBox.Selected.Value), Value(CreatedTimeSecondBox.Selected.Value)), "[$-en-US]yyyymmddHHmmss")) < Value(Text(AcknowledgedItemDatePicker.SelectedDate + Time(Value(AcknowledgedItemHourBox.Selected.Value), Value(AcknowledgedItemMinuteBox.Selected.Value), Value(AcknowledgedItemSecondBox.Selected.Value)),"[$-en-US]yyyymmddHHmmss"))

If you want the Received Item Date/time card to be less than acknowledged item, please take a try with the following formula:

(ReceivedItemDatePicker.SelectedDate + Time(Value(ReceivedItemHourBox.Selected.Value), Value(ReceivedItemMinuteBox.Selected.Value), Value(ReceivedItemSecondBox.Selected.Value))) < (AcknowledgedItemDatePicker.SelectedDate + Time(Value(AcknowledgedItemHourBox.Selected.Value), Value(AcknowledgedItemMinuteBox.Selected.Value), Value(AcknowledgedItemSecondBox.Selected.Value)))

Or

Value(Text(ReceivedItemDatePicker.SelectedDate + Time(Value(ReceivedItemHourBox.Selected.Value), Value(ReceivedItemMinuteBox.Selected.Value), Value(ReceivedItemSecondBox.Selected.Value)), "[$-en-US]yyyymmddHHmmss")) < Value(Text(AcknowledgedItemDatePicker.SelectedDate + Time(Value(AcknowledgedItemHourBox.Selected.Value), Value(AcknowledgedItemMinuteBox.Selected.Value), Value(AcknowledgedItemSecondBox.Selected.Value)),"[$-en-US]yyyymmddHHmmss"))

 

If you want to check if the Created Date/time card has to be less than all the date times under it, or Received has to be less than acknowledged item, you could consider put above formula within a If function. e.g.

If(
    (CreatedTimeDatePicker.SelectedDate + Time(Value(CreatedTimeHourBox.Selected.Value), Value(CreatedTimeMinuteBox.Selected.Value), Value(CreatedTimeSecondBox.Selected.Value))) < (ReceivedItemDatePicker.SelectedDate + Time(Value(ReceivedItemHourBox.Selected.Value), Value(ReceivedItemMinuteBox.Selected.Value), Value(ReceivedItemSecondBox.Selected.Value))) &&
(CreatedTimeDatePicker.SelectedDate + Time(Value(CreatedTimeHourBox.Selected.Value), Value(CreatedTimeMinuteBox.Selected.Value), Value(CreatedTimeSecondBox.Selected.Value))) < (AcknowledgedItemDatePicker.SelectedDate + Time(Value(AcknowledgedItemHourBox.Selected.Value), Value(AcknowledgedItemMinuteBox.Selected.Value), Value(AcknowledgedItemSecondBox.Selected.Value))),
"Created Date/time card is less than all the date times under it",
"Created Date/time card is not less than all the date times under it" )

Or

If(
   Value(Text(CreatedTimeDatePicker.SelectedDate + Time(Value(CreatedTimeHourBox.Selected.Value), Value(CreatedTimeMinuteBox.Selected.Value), Value(CreatedTimeSecondBox.Selected.Value)), "[$-en-US]yyyymmddHHmmss")) < Value(Text(ReceivedItemDatePicker.SelectedDate + Time(Value(ReceivedItemHourBox.Selected.Value), Value(ReceivedItemMinuteBox.Selected.Value), Value(ReceivedItemSecondBox.Selected.Value)), "[$-en-US]yyyymmddHHmmss")) &&
Value(Text(CreatedTimeDatePicker.SelectedDate + Time(Value(CreatedTimeHourBox.Selected.Value), Value(CreatedTimeMinuteBox.Selected.Value), Value(CreatedTimeSecondBox.Selected.Value)), "[$-en-US]yyyymmddHHmmss")) < Value(Text(AcknowledgedItemDatePicker.SelectedDate + Time(Value(AcknowledgedItemHourBox.Selected.Value), Value(AcknowledgedItemMinuteBox.Selected.Value), Value(AcknowledgedItemSecondBox.Selected.Value)),"[$-en-US]yyyymmddHHmmss")),
"Created Date/time card is less than all the date times under it",
"Created Date/time card is not less than all the date times under it" )

...

 

Please consider take a try with above solution, then check if the issue is solved. Please also check the sample app I provided below for more details.

 

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.

Helpful resources

Announcements
firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Top Community Contributors for July 2019

Top Community Contributors for July 2019

Let's thank our top community contributors

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

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

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

FifthImage

Dynamics 365 and Power Platform April 2019 Release notes

Features releasing from April 2019 through September 2019!

SixthImage

Power Summit Australia 2019

August 20-23rd 2019

Users Online
Currently online: 199 members 4,589 guests
Please welcome our newest community members: