Esri / arcade-expressions

ArcGIS Arcade expression templates for all supported profiles in the ArcGIS platform.
Apache License 2.0
284 stars 101 forks source link

Support for Monthly Schedules in My Trash Services #94

Open ernestocd opened 1 month ago

ernestocd commented 1 month ago

Check existing issues

Execution profile

Any

Is your feature request related to a problem? Please describe.

I am using the My Trash Services ArcGIS Solution to share waste pickup and recycling schedules with the public: My Trash Services Solution.

In our city, we have both weekly and monthly service schedules. While the system functions as expected when configured with weekly schedules, I am encountering an issue when using the monthly schedule configuration.

For monthly setups, the workflow involves:

Selecting the schedule type as "Monthly." Specifying which days of the week will have service (e.g., Monday = Yes, Thursday = Yes). Indicating which week of the month the service will occur (e.g., Week One = Yes). Once the data is published and deployed using the provided app, there is an Arcade expression that calculates the Next Pickup Date (attached for reference). However, this expression does not return the correct dates when using the monthly schedule configuration.

Next Pickup.txt

Describe the solution you'd like

I would like the Arcade expression to be enhanced to support monthly schedules in accordance with the configuration provided by the user in the solution's data table.

Example: Using October 2024 as a sample:

Schedule Type: Monthly Day: Monday = Yes Week: Week One = Yes The expected output should be the first Monday of October, which would be October 7, 2024. Currently, the expression does not calculate this correctly.

Describe alternatives you've considered

Currently, I am using a separate script outside of the solution to calculate this value as a Windows Task Scheduler job. However, I would prefer that everything is handled within Arcade, as the rest of the solution is already implemented this way. I do not want to rely on a scheduled task for this calculation.

Additional context

Next Pickup.txt