Greetings, all!
I am configuring the My Trash Services solution deployed from the ArcGIS Solutions App, and specifically configuring the Next Pickup Arcade expression for the Pickup [polygon] layers. The expression includes a variable for nextPickupHoliday where I can configure "Next Weekday", "Next Day", or "Next Scheduled Pickup", and the returned value will be the next weekday, next day, or next scheduled pickup day, respectively.
I am seeking help to update the expression to accommodate the following scenario:
So, two scenarios to this special case: (1) if the pickup day is on a specific holiday, then the next pickup day will be on a specific day of the week during that week, and (2) if the pickup day is on a specific holiday, then there will be no pickup day during that week.
Since the Solutions experience updates and can change, I have included the Arcade expression below that I am using.
/*If pickup occurs weekly, specify 1.
If every other week specify 2, etc.*/
var pickupWeekInterval = 1;
/*Specify a date in the past in which pickup occurred.
This is used in the case where pickup doesn't occur every week
to determine the weeks where pickup is occurring.*/
var firstPickupWeek = Date('2017-01-01');
/*If the pickup service isn't available year-round
specify the first and last day of the season that pickup will occur, [[Start Month, Start Day], [[End Month, End Day]]*/
var openSeason = [[1,1],[12,31]]
//Specify any holidays where pickup will not occur, [Month, Day]
var holidays = [[1,1],[7,4],[12,25]]
/*Specify any variable holidays where pickup will not occur, [Occurrence, Month, Day of the Week (Sunday = 0, Saturday = 6)]
These are holidays that don't fall on the same date every year, i.e. Memorial Day, Labor Day, Thanksgiving
[-1,5,1] corresponds to Memorial Day -> Last occurrence in May of a Monday
[1,9,1] corresponds to Labor Day -> 1st occurrence in September of a Monday
[4,11,4] corresponds to Thanksgiving -> 4th occurrence in November of a Thursday*/
var variableHolidays = [[-1,5,1],[1,9,1],[4,11,4]];
/*Specify if the next scheduled pickup day falls on a holiday, when will the next actual pickup be.
"Next Weekday" - The pickup will occur on the next weekday after the holiday
"Next Day" - The pickup will occur on the next day after the holiday
"Next Scheduled Pickup" - The pickup will occur on the next scheduled day after the holiday*/
var nextPickupHoliday = "Next Weekday";
var pickupDays = [];
var pickupDaysFields = [$feature.SUNDAY, $feature.MONDAY, $feature.TUESDAY,
$feature.WEDNESDAY, $feature.THURSDAY,
$feature.FRIDAY, $feature.SATURDAY]
for (var k in pickupDaysFields) {
if (pickupDaysFields[k] == 'Yes') {
pickupDays[Count(pickupDays)] = k;
}
}
if (Count(pickupDays) == 0)
return;
function calcRelativeHoliday(week, month, day, year) {
var holiday;
if (week < 0){
var lastDay = DateAdd(Date(year, month + 1, 1), -1, 'days');
var dayOfWeek = Weekday(lastDay);
var dayDiff = day - dayOfWeek;
if (dayDiff > 0)
dayDiff -= 7;
holiday = DateAdd(lastDay, dayDiff + ((week + 1) * 7), 'days');
}
else{
var firstDay = Date(year, month, 1);
var dayOfWeek = Weekday(firstDay);
var dayDiff = day - dayOfWeek;
if (dayDiff < 0)
dayDiff += 7;
holiday = DateAdd(firstDay, dayDiff + ((week - 1) * 7), 'days');
}
return holiday;
}
function getNextPickupDay(fromDate) {
var currentDay = Weekday(fromDate);
var pickupOffset = 0;
if (pickupWeekInterval > 1){
var weekDif = DateDiff(DateAdd(fromDate, 0 - currentDay, 'days'),
DateAdd(firstPickupWeek, 0 - Weekday(firstPickupWeek), 'days'),
'days') / 7;
weekDif = weekDif % pickupWeekInterval;
if (weekDif > 0)
pickupOffset = pickupWeekInterval - weekDif;
}
var difDays;
var nextPickupDay;
if (pickupOffset > 0) {
nextPickupDay = pickupDays[0];
difDays = nextPickupDay - currentDay;
difDays += (7 * pickupOffset);
}
else {
for(var k in pickupDays) {
if (pickupDays[k] >= currentDay) {
nextPickupDay = pickupDays[k];
break;
}
}
if (IsEmpty(nextPickupDay))
nextPickupDay = pickupDays[0];
difDays = nextPickupDay - currentDay;
if (nextPickupDay < currentDay)
difDays += (7 * pickupWeekInterval);
}
return DateAdd(fromDate, difDays, 'days');
}
function getHolidays(fromDate) {
var holidayDates = [];
for (var k in holidays) {
var holiday = Date(Year(fromDate), holidays[k][0] -1, holidays[k][1]);
if (holiday < fromDate)
holiday = Date(Year(fromDate) + 1, holidays[k][0] -1, holidays[k][1]);
holidayDates[k] = holiday;
}
for (var k in variableHolidays) {
var x = variableHolidays[k];
var holiday = calcRelativeHoliday(x[0], x[1]-1, x[2], Year(fromDate));
if (holiday < fromDate)
holiday = calcRelativeHoliday(x[0], x[1]-1, x[2], Year(fromDate) + 1);
holidayDates[Count(holidayDates)] = holiday;
}
return holidayDates;
}
function validateSeasonPickup(pickupDate) {
var startSeasonMonth = openSeason[0][0]-1;
var startSeasonDay = openSeason[0][1];
var endSeasonMonth = openSeason[1][0]-1;
var endSeasonDay = openSeason[1][1];
if (Date(Year(pickupDate), startSeasonMonth, startSeasonDay) > Date(Year(pickupDate), endSeasonMonth, endSeasonDay)) {
if (pickupDate < Date(Year(pickupDate), startSeasonMonth, startSeasonDay) && pickupDate > Date(Year(pickupDate) - 1, endSeasonMonth, endSeasonDay))
pickupDate = getNextPickupDay(Date(Year(pickupDate), startSeasonMonth, startSeasonDay))
}
else {
if (pickupDate < Date(Year(pickupDate), startSeasonMonth, startSeasonDay))
pickupDate = getNextPickupDay(Date(Year(pickupDate), startSeasonMonth, startSeasonDay));
else if (pickupDate > Date(Year(pickupDate), endSeasonMonth, endSeasonDay))
pickupDate = getNextPickupDay(Date(Year(pickupDate) + 1, startSeasonMonth, startSeasonDay));
}
return pickupDate;
}
function validateHolidayPickup(pickupDate, holidayDates) {
for(var k in holidayDates) {
if (pickupDate == holidayDates[k]) {
if (nextPickupHoliday == "Next Scheduled Pickup") {
pickupDate = getNextPickupDay(DateAdd(pickupDate, 1, 'days'));
}
else if (nextPickupHoliday == "Next Day") {
pickupDate = DateAdd(pickupDate, 1, 'days');
}
else if (nextPickupHoliday == "Next Weekday") {
var currentDay = Weekday(pickupDate);
if (currentDay > 4) {
pickupDate = DateAdd(pickupDate, 8 - currentDay, 'days');
}
else {
pickupDate = DateAdd(pickupDate, 1, 'days');
}
}
break;
}
}
return pickupDate
}
var nextPickup = getNextPickupDay(Today());
nextPickup = validateSeasonPickup(nextPickup);
nextPickup = validateHolidayPickup(nextPickup, getHolidays(nextPickup));
return Text(nextPickup, 'dddd, MMMM D');
I genuinely appreciate any help and suggestions for best or better practices when working with expressions. Thanks all!
Solved! Go to Solution.
Hi Kyle,
Give the update expression below a shot. In this I updated the holidays variable to be a dictionary, where the key is the what should be down for the holiday and the value is the list of holidays that apply to that option. So you can see, in the code below for the holidays you specified the next pickup will either be the next Thursday, or occur at the Next Schedule Pickup.
The only thing this script doesn't account for now is Christmas and New Years are 1 week apart. What is the expectation for these holidays when the pickup date falls on Christmas the Next Scheduled Pickup would be New Years Day. Would you want the next pickup to be a week after New Years then?
/*If pickup occurs weekly, specify 1.
If every other week specify 2, etc.*/
var pickupWeekInterval = 1;
/*Specify a date in the past in which pickup occurred.
This is used in the case where pickup doesn't occur every week
to determine the weeks where pickup is occurring.*/
var firstPickupWeek = Date('2017-01-01');
/*If the pickup service isn't available year-round
specify the first and last day of the season that pickup will occur, [[Start Month, Start Day], [[End Month, End Day]]*/
var openSeason = [[1,1],[12,31]]
/*Specify if the next scheduled pickup day falls on a holiday, when will the next actual pickup be.
"Next Weekday" - The pickup will occur on the next weekday after the holiday
"Next Day" - The pickup will occur on the next day after the holiday
"Next Day of Week - 4" - The pickup will occur on the next day of the week (Sunday = 0, Saturday = 6)
"Next Scheduled Pickup" - The pickup will occur on the next scheduled day after the holiday*/
/*Specify any holidays where pickup will not occur, [Month, Day]
Specify any variable holidays where pickup will not occur, [Occurrence, Month, Day of the Week (Sunday = 0, Saturday = 6)]
These are holidays that don't fall on the same date every year, i.e. Memorial Day, Labor Day, Thanksgiving
[-1,5,1] corresponds to Memorial Day -> Last occurrence in May of a Monday
[1,9,1] corresponds to Labor Day -> 1st occurrence in September of a Monday
[4,11,4] corresponds to Thanksgiving -> 4th occurrence in November of a Thursday*/
var holidays = {
"Next Weekday": [],
"Next Day": [],
"Next Day of Week - 4": [[-1,5,1],[7,4],[1,9,1]],
"Next Scheduled Pickup": [[1,1],[4,11,4],[12,25]]
}
var pickupDays = [];
var pickupDaysFields = [$feature.SUNDAY, $feature.MONDAY, $feature.TUESDAY,
$feature.WEDNESDAY, $feature.THURSDAY,
$feature.FRIDAY, $feature.SATURDAY]
for (var k in pickupDaysFields) {
if (pickupDaysFields[k] == 'Yes') {
pickupDays[Count(pickupDays)] = k;
}
}
if (Count(pickupDays) == 0)
return;
function calcRelativeHoliday(week, month, day, year) {
var holiday;
if (week < 0){
var lastDay = DateAdd(Date(year, month + 1, 1), -1, 'days');
var dayOfWeek = Weekday(lastDay);
var dayDiff = day - dayOfWeek;
if (dayDiff > 0)
dayDiff -= 7;
holiday = DateAdd(lastDay, dayDiff + ((week + 1) * 7), 'days');
}
else{
var firstDay = Date(year, month, 1);
var dayOfWeek = Weekday(firstDay);
var dayDiff = day - dayOfWeek;
if (dayDiff < 0)
dayDiff += 7;
holiday = DateAdd(firstDay, dayDiff + ((week - 1) * 7), 'days');
}
return holiday;
}
function getNextPickupDay(fromDate) {
var currentDay = Weekday(fromDate);
var pickupOffset = 0;
if (pickupWeekInterval > 1){
var weekDif = DateDiff(DateAdd(fromDate, 0 - currentDay, 'days'),
DateAdd(firstPickupWeek, 0 - Weekday(firstPickupWeek), 'days'),
'days') / 7;
weekDif = weekDif % pickupWeekInterval;
if (weekDif > 0)
pickupOffset = pickupWeekInterval - weekDif;
}
var difDays;
var nextPickupDay;
if (pickupOffset > 0) {
nextPickupDay = pickupDays[0];
difDays = nextPickupDay - currentDay;
difDays += (7 * pickupOffset);
}
else {
for(var k in pickupDays) {
if (pickupDays[k] >= currentDay) {
nextPickupDay = pickupDays[k];
break;
}
}
if (IsEmpty(nextPickupDay))
nextPickupDay = pickupDays[0];
difDays = nextPickupDay - currentDay;
if (nextPickupDay < currentDay)
difDays += (7 * pickupWeekInterval);
}
return DateAdd(fromDate, difDays, 'days');
}
function getHolidays(fromDate) {
var holidayDates = {};
for (var k in holidays) {
var dates = [];
for (var d in holidays[k]) {
if (Count(holidays[k][d]) == 2) {
var holiday = Date(Year(fromDate), holidays[k][d][0] -1, holidays[k][d][1]);
if (holiday < fromDate) {
holiday = Date(Year(fromDate) + 1, holidays[k][d][0] -1, holidays[k][d][1]);
}
dates[d] = holiday;
}
else {
var x = holidays[k][d];
var holiday = calcRelativeHoliday(x[0], x[1]-1, x[2], Year(fromDate));
if (holiday < fromDate) {
holiday = calcRelativeHoliday(x[0], x[1]-1, x[2], Year(fromDate) + 1);
}
dates[d] = holiday;
}
}
holidayDates[k] = dates;
}
return holidayDates;
}
function validateSeasonPickup(pickupDate) {
var startSeasonMonth = openSeason[0][0]-1;
var startSeasonDay = openSeason[0][1];
var endSeasonMonth = openSeason[1][0]-1;
var endSeasonDay = openSeason[1][1];
if (Date(Year(pickupDate), startSeasonMonth, startSeasonDay) > Date(Year(pickupDate), endSeasonMonth, endSeasonDay)) {
if (pickupDate < Date(Year(pickupDate), startSeasonMonth, startSeasonDay) && pickupDate > Date(Year(pickupDate) - 1, endSeasonMonth, endSeasonDay))
pickupDate = getNextPickupDay(Date(Year(pickupDate), startSeasonMonth, startSeasonDay))
}
else {
if (pickupDate < Date(Year(pickupDate), startSeasonMonth, startSeasonDay))
pickupDate = getNextPickupDay(Date(Year(pickupDate), startSeasonMonth, startSeasonDay));
else if (pickupDate > Date(Year(pickupDate), endSeasonMonth, endSeasonDay))
pickupDate = getNextPickupDay(Date(Year(pickupDate) + 1, startSeasonMonth, startSeasonDay));
}
return pickupDate;
}
function validateHolidayPickup(pickupDate, holidayDates) {
for(var k in holidayDates) {
for (var d in holidayDates[k]) {
if (pickupDate == holidayDates[k][d]) {
if (k == "Next Scheduled Pickup") {
pickupDate = getNextPickupDay(DateAdd(pickupDate, 1, 'days'));
}
else if (k == "Next Day") {
pickupDate = DateAdd(pickupDate, 1, 'days');
}
else if (k == "Next Weekday") {
var currentDay = Weekday(pickupDate);
if (currentDay > 4) {
pickupDate = DateAdd(pickupDate, 8 - currentDay, 'days');
}
else {
pickupDate = DateAdd(pickupDate, 1, 'days');
}
}
else if (Find('Next Day of Week', k) > -1) {
var dayOfWeek = Number(Right(k, 1));
var currentDay = Weekday(pickupDate);
if (currentDay > dayOfWeek) {
pickupDate = DateAdd(pickupDate, (dayOfWeek + 7) - currentDay, 'days');
}
else {
pickupDate = DateAdd(pickupDate, dayOfWeek-currentDay, 'days');
}
}
break;
}
}
}
return pickupDate
}
var nextPickup = getNextPickupDay(Today());
nextPickup = validateSeasonPickup(nextPickup);
nextPickup = validateHolidayPickup(nextPickup, getHolidays(nextPickup));
return Text(nextPickup, 'dddd, MMMM D');
Kyle - Looping @ChrisFox in. He authored the original expression and can help with the scenario you proposed.
Hi Kyle,
So If I read correctly you are saying if the pickup day falls on Memorial Day, Independence Day or Labor Day they won't pickup on the holiday, instead the next pickup will be the following Thursday? So this year Labor Day is on a Wednesday, would the next pickup be Thursday the 2nd or Thursday the 9th?
For Thanksgiving, Christmas, and New Years, you want it to behave just like the next scheduled pickup day, i.e, don't pickup this week, resume normal schedule the following week?
Thanks, Scott!
Hey Chris! Yes, that is correct. For this year, Labor Day is on Monday 9/6 and the next pickup day will be Thursday 9/9. The pattern for those three holidays is that if the next pickup day is a holiday, then the holiday pick up date will be the Thursday immediately following the original day. For Thanksgiving, Christmas, and New Year's, you are also correct - there will be no scheduled pick up that week and normal pickup will resume the following week.
Almost like a hybrid of 'Next Scheduled Pickup' and a new or modified nextPickupHoliday that considers a dictionary of specific holidays with their respective designated pickup dates.
Hi Kyle,
Give the update expression below a shot. In this I updated the holidays variable to be a dictionary, where the key is the what should be down for the holiday and the value is the list of holidays that apply to that option. So you can see, in the code below for the holidays you specified the next pickup will either be the next Thursday, or occur at the Next Schedule Pickup.
The only thing this script doesn't account for now is Christmas and New Years are 1 week apart. What is the expectation for these holidays when the pickup date falls on Christmas the Next Scheduled Pickup would be New Years Day. Would you want the next pickup to be a week after New Years then?
/*If pickup occurs weekly, specify 1.
If every other week specify 2, etc.*/
var pickupWeekInterval = 1;
/*Specify a date in the past in which pickup occurred.
This is used in the case where pickup doesn't occur every week
to determine the weeks where pickup is occurring.*/
var firstPickupWeek = Date('2017-01-01');
/*If the pickup service isn't available year-round
specify the first and last day of the season that pickup will occur, [[Start Month, Start Day], [[End Month, End Day]]*/
var openSeason = [[1,1],[12,31]]
/*Specify if the next scheduled pickup day falls on a holiday, when will the next actual pickup be.
"Next Weekday" - The pickup will occur on the next weekday after the holiday
"Next Day" - The pickup will occur on the next day after the holiday
"Next Day of Week - 4" - The pickup will occur on the next day of the week (Sunday = 0, Saturday = 6)
"Next Scheduled Pickup" - The pickup will occur on the next scheduled day after the holiday*/
/*Specify any holidays where pickup will not occur, [Month, Day]
Specify any variable holidays where pickup will not occur, [Occurrence, Month, Day of the Week (Sunday = 0, Saturday = 6)]
These are holidays that don't fall on the same date every year, i.e. Memorial Day, Labor Day, Thanksgiving
[-1,5,1] corresponds to Memorial Day -> Last occurrence in May of a Monday
[1,9,1] corresponds to Labor Day -> 1st occurrence in September of a Monday
[4,11,4] corresponds to Thanksgiving -> 4th occurrence in November of a Thursday*/
var holidays = {
"Next Weekday": [],
"Next Day": [],
"Next Day of Week - 4": [[-1,5,1],[7,4],[1,9,1]],
"Next Scheduled Pickup": [[1,1],[4,11,4],[12,25]]
}
var pickupDays = [];
var pickupDaysFields = [$feature.SUNDAY, $feature.MONDAY, $feature.TUESDAY,
$feature.WEDNESDAY, $feature.THURSDAY,
$feature.FRIDAY, $feature.SATURDAY]
for (var k in pickupDaysFields) {
if (pickupDaysFields[k] == 'Yes') {
pickupDays[Count(pickupDays)] = k;
}
}
if (Count(pickupDays) == 0)
return;
function calcRelativeHoliday(week, month, day, year) {
var holiday;
if (week < 0){
var lastDay = DateAdd(Date(year, month + 1, 1), -1, 'days');
var dayOfWeek = Weekday(lastDay);
var dayDiff = day - dayOfWeek;
if (dayDiff > 0)
dayDiff -= 7;
holiday = DateAdd(lastDay, dayDiff + ((week + 1) * 7), 'days');
}
else{
var firstDay = Date(year, month, 1);
var dayOfWeek = Weekday(firstDay);
var dayDiff = day - dayOfWeek;
if (dayDiff < 0)
dayDiff += 7;
holiday = DateAdd(firstDay, dayDiff + ((week - 1) * 7), 'days');
}
return holiday;
}
function getNextPickupDay(fromDate) {
var currentDay = Weekday(fromDate);
var pickupOffset = 0;
if (pickupWeekInterval > 1){
var weekDif = DateDiff(DateAdd(fromDate, 0 - currentDay, 'days'),
DateAdd(firstPickupWeek, 0 - Weekday(firstPickupWeek), 'days'),
'days') / 7;
weekDif = weekDif % pickupWeekInterval;
if (weekDif > 0)
pickupOffset = pickupWeekInterval - weekDif;
}
var difDays;
var nextPickupDay;
if (pickupOffset > 0) {
nextPickupDay = pickupDays[0];
difDays = nextPickupDay - currentDay;
difDays += (7 * pickupOffset);
}
else {
for(var k in pickupDays) {
if (pickupDays[k] >= currentDay) {
nextPickupDay = pickupDays[k];
break;
}
}
if (IsEmpty(nextPickupDay))
nextPickupDay = pickupDays[0];
difDays = nextPickupDay - currentDay;
if (nextPickupDay < currentDay)
difDays += (7 * pickupWeekInterval);
}
return DateAdd(fromDate, difDays, 'days');
}
function getHolidays(fromDate) {
var holidayDates = {};
for (var k in holidays) {
var dates = [];
for (var d in holidays[k]) {
if (Count(holidays[k][d]) == 2) {
var holiday = Date(Year(fromDate), holidays[k][d][0] -1, holidays[k][d][1]);
if (holiday < fromDate) {
holiday = Date(Year(fromDate) + 1, holidays[k][d][0] -1, holidays[k][d][1]);
}
dates[d] = holiday;
}
else {
var x = holidays[k][d];
var holiday = calcRelativeHoliday(x[0], x[1]-1, x[2], Year(fromDate));
if (holiday < fromDate) {
holiday = calcRelativeHoliday(x[0], x[1]-1, x[2], Year(fromDate) + 1);
}
dates[d] = holiday;
}
}
holidayDates[k] = dates;
}
return holidayDates;
}
function validateSeasonPickup(pickupDate) {
var startSeasonMonth = openSeason[0][0]-1;
var startSeasonDay = openSeason[0][1];
var endSeasonMonth = openSeason[1][0]-1;
var endSeasonDay = openSeason[1][1];
if (Date(Year(pickupDate), startSeasonMonth, startSeasonDay) > Date(Year(pickupDate), endSeasonMonth, endSeasonDay)) {
if (pickupDate < Date(Year(pickupDate), startSeasonMonth, startSeasonDay) && pickupDate > Date(Year(pickupDate) - 1, endSeasonMonth, endSeasonDay))
pickupDate = getNextPickupDay(Date(Year(pickupDate), startSeasonMonth, startSeasonDay))
}
else {
if (pickupDate < Date(Year(pickupDate), startSeasonMonth, startSeasonDay))
pickupDate = getNextPickupDay(Date(Year(pickupDate), startSeasonMonth, startSeasonDay));
else if (pickupDate > Date(Year(pickupDate), endSeasonMonth, endSeasonDay))
pickupDate = getNextPickupDay(Date(Year(pickupDate) + 1, startSeasonMonth, startSeasonDay));
}
return pickupDate;
}
function validateHolidayPickup(pickupDate, holidayDates) {
for(var k in holidayDates) {
for (var d in holidayDates[k]) {
if (pickupDate == holidayDates[k][d]) {
if (k == "Next Scheduled Pickup") {
pickupDate = getNextPickupDay(DateAdd(pickupDate, 1, 'days'));
}
else if (k == "Next Day") {
pickupDate = DateAdd(pickupDate, 1, 'days');
}
else if (k == "Next Weekday") {
var currentDay = Weekday(pickupDate);
if (currentDay > 4) {
pickupDate = DateAdd(pickupDate, 8 - currentDay, 'days');
}
else {
pickupDate = DateAdd(pickupDate, 1, 'days');
}
}
else if (Find('Next Day of Week', k) > -1) {
var dayOfWeek = Number(Right(k, 1));
var currentDay = Weekday(pickupDate);
if (currentDay > dayOfWeek) {
pickupDate = DateAdd(pickupDate, (dayOfWeek + 7) - currentDay, 'days');
}
else {
pickupDate = DateAdd(pickupDate, dayOfWeek-currentDay, 'days');
}
}
break;
}
}
}
return pickupDate
}
var nextPickup = getNextPickupDay(Today());
nextPickup = validateSeasonPickup(nextPickup);
nextPickup = validateHolidayPickup(nextPickup, getHolidays(nextPickup));
return Text(nextPickup, 'dddd, MMMM D');
Hi Chris,
This is great! Thank you for your work on this. It is greatly appreciated!
In the event that the Next Pickup Date is Christmas, which would mean the Next Pickup Date is scheduled for New Years Day which is also a 'no service' holiday, the Next Pickup Date would be the next regular pickup date in January. Simply put, there would be no pickup service the week of Christmas and New Years IF the Next Pickup Date falls on either of those days.
Hi again, Chris,
An update regarding holiday pickup dates from the county local government that is using this. If the next scheduled pickup is a holiday, then the next scheduled pickup will be the Thursday of the same week. No regular services are provided on Thursdays, so the county does not outline how to handle next pickup dates if it is a Thursday.
I apologize for not having this information before. The local government is VERY happy to have the My Trash Services solution, and wants to make sure it is accurate for its residents. The app usage spikes during holidays and that is when it is most important to have the correct information.
Thanks for all of your help on this one, and will be happy to share the application when completed! Will actually be expanding the My Trash Services solution into a fully comprehensive Hub initiative!
Hi Kyle,
That makes a lot of sense, that updated expression should do it for them then. I also wanted to connect @AndyShoemaker with you. He is on my team and is working on an update to the My Trash Services solution. We were also considering adding a Hub site with the solution and potentially workflows around Bulk Trash Pickup. It would be great if he could pick your brain on some of the requirements you have learned from your customers for this solution to see how that aligns with the requirements we have been hearing.
Thanks,
-Chris
Hey Chris,
An additional follow up that I wanted to put here for documentation purposes and for others is that regarding the next pickup date for Independence Day. Since Independence Days is on a Sunday this year, the observed holiday date will be 7/5. Pickup districts with Monday pickup service were still displaying Monday 7/5 as the next pickup date even though the next pickup date is actually Thursday 7/8.
To adjust for this, I made the following update to line 30 of the expression that you posted.
"Next Day of Week - 4": [[-1,5,1],[7,5],[1,9,1]],
I simply changed the date of Independence Day to 7/5 so that the Arcade expression will return the actual next pickup date. This case brings to light the difference in how holidays are handled and how observed holidays are handled. For now, I have updated line 30, and added a commented out note that states why Independence Day is 7/5 and when it should be changed back to 7/4.