I have a database which categorizes records into views based on a field called planned_date and that field’s value when compared to today’s date. One view lists all items planned for this week, and two other views show items planned for last week and also for next week. A “flag” field is set up for each time period to indicate what view the record should be in.
The week starts on Sunday and ends on Saturday, so if today is Tuesday and the planned_date value is 3 days ago, the last_week flag would be set to “1”, and the other two flag fields would be set to “0”. The record would appear in the view containing items planned for last week. If today is Friday and the planned_date is 3 days ago, the this_week flag would be set to “1” and the other two fields set to “0”.
I’ve been able to do this using @adjust and @if statements in the flag fields themselves, but this requires manually refreshing the forms each morning. I’d like to write a script that will loop through all documents in the “Recent” view (contains all records with plan_date within 14 days +/-) and set these three flag fields during a scheduled agent, but i’m not sure how best to approach it.
Any ideas?