cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper I
Helper I

Re: Evaluate to see if two date fields are in range of any existing records in the common data service

Hi Kris Dai,

 

Just to confirm, there are four end dates in the last two OR statements, is that correct? Or should there be a start date somewhere inbetween?

 

EndDates.jpg

 

If the above is correct, its still allowing for time periods to cross over those time periods:

 

Third Attempt.jpg

 

As you can see from the above, I should not be able to enable the button when the start and end dates cross over existing record data within that time period.

 

Regards,

Barry Francis

Highlighted
Helper I
Helper I

Re: Evaluate to see if two date fields are in range of any existing records in the common data service

Hi there,

 

I am trying a few things to resolve this, one of the solutions I'm looking at is to create a collection of dates inbetween the two selected dates, then use a lookup to see if there is a match across the one gallery to the other.

 

Here is the collection I am setting on change of the two date pickers:

 

ClearCollect(
DateRange,
AddColumns(
FirstN(
[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32],
DateDiff(StartDate.SelectedDate, EndDate.SelectedDate, Days) + 1),
"Day",
"Day " & (Value + 1),
"Date",
DateAdd(StartDate.SelectedDate, Value, Days)
)
)

 

Then I am setting the values into a gallery:

 

Alternate Solution.jpg

 

Then I am setting a label to try and work in a lookup to see if any of records on the individual date gallery matches one of the dates in the other gallery, but am struggling to get that IF formula correct:

 

If(!IsBlank(LookUp(SingleDateGallery.AllItems, Value(Text(Date, "[$-en-US]yyyymmdd")) = Value(Text(DateFromGallery, "[$-en-US]yyyymmdd")))),"Date Found","No Dates Found")

 

SingleDateGallery --> gallery with each date listed out

Date --> The date each collect is returning

DateFromGallery --> The date labels in the gallery with the from and to dates.

 

Regards,

Barry Francis

Highlighted
Helper I
Helper I

Re: Evaluate to see if two date fields are in range of any existing records in the common data service

Hi Kris Dai,

 

I played around with the code you sent me and found the solution:

 

If(
!IsBlank(LookUp('Leave Requests', Value(Text(crbb9_datefrom, "[$-en-US]yyyymmdd")) <= Value(Text(StartDate.SelectedDate,"[$-en-US]yyyymmdd")) && Value(Text(crbb9_dateto, "[$-en-US]yyyymmdd")) >=
Value(Text(StartDate.SelectedDate, "[$-en-US]yyyymmdd")))) ||
!IsBlank(LookUp('Leave Requests', Value(Text(crbb9_datefrom, "[$-en-US]yyyymmdd")) <= Value(Text(EndDate.SelectedDate,"[$-en-US]yyyymmdd")) && Value(Text(crbb9_dateto, "[$-en-US]yyyymmdd")) >=
Value(Text(EndDate.SelectedDate, "[$-en-US]yyyymmdd")))) ||
!IsBlank(LookUp('Leave Requests', Value(Text(crbb9_datefrom, "[$-en-US]yyyymmdd")) > Value(Text(StartDate.SelectedDate, "[$-en-US]yyyymmdd")) && Value(Text(crbb9_dateto, "[$-en-US]yyyymmdd")) <
Value(Text(EndDate.SelectedDate, "[$-en-US]yyyymmdd")))),
DisplayMode.Disabled,DisplayMode.Edit)

 

The start date must be less than the from date and the end date must be greater than the to date.

 

Thanks for all the assistance.

 

Regards,

Barry Francis

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Tech Marathon

Maratón de Soluciones de Negocio Microsoft

Una semana de contenido con +100 sesiones educativas, consultorios, +10 workshops Premium, Hackaton, EXPO, Networking Hall y mucho más!

Top Solution Authors
Top Kudoed Authors
Users online (3,225)