Thanks for your responses - your understanding is correct.
Button 1 (the one that fails):
Set(varPath,"Duty Sheets/"&Text(Today()-(Weekday(Today(), StartOfWeek.Sunday))+1, "mmmm")&"/"&Text(Today()-(Weekday(Today(), StartOfWeek.Sunday))+1, "yyyy-mm-dd")&"_Employee_Final.xlsx");UpdateContext({varLoadDS:true});
ClearCollect(
dutysheetTW,
ForAll(
Table(
ParseJSON(
DSTEST.Run("/"&varPath).table
)
),
{
'1': Text(Value.'1'),
'2': Text(Value.'2'),
'3': Text(Value.'3'),
'4': Text(Value.'4'),
'5': Text(Value.'5'),
'6': Text(Value.'6'),
'7': Text(Value.'7'),
'8': Text(Value.'8'),
'9': Text(Value.'9'),
'10': Text(Value.'10'),
'11': Text(Value.'11'),
'12': Text(Value.'12'),
'13': Text(Value.'13')
}));
UpdateContext({varLoadDS:false})
Button 2:
Set(varPath,"Duty Sheets/"&Text(DateAdd(Today(),(7- Weekday(Today(),StartOfWeek.Sunday)),TimeUnit.Days)+1, "mmmm")&"/"&Text(DateAdd(Today(),(7- Weekday(Today(),StartOfWeek.Sunday)),TimeUnit.Days)+1, "yyyy-mm-dd")&"_Employee_Final.xlsx");UpdateContext({varLoadDS:true});
ClearCollect(
dutysheet,
ForAll(
Table(
ParseJSON(
DSTEST.Run("/"&varPath).table
)
),
{
'1': Text(Value.'1'),
'2': Text(Value.'2'),
'3': Text(Value.'3'),
'4': Text(Value.'4'),
'5': Text(Value.'5'),
'6': Text(Value.'6'),
'7': Text(Value.'7'),
'8': Text(Value.'8'),
'9': Text(Value.'9'),
'10': Text(Value.'10'),
'11': Text(Value.'11'),
'12': Text(Value.'12'),
'13': Text(Value.'13')
}));
UpdateContext({varLoadDS:false})
The convoluted date additions etc are just to get the date of the Sunday for the corresponding week, the paths it produces are:
Button 1:
Duty Sheets/May/2024-05-26_Employee_Final.xlsx
Button 2:
Duty Sheets/June/2024-06-02_Employee_Final.xlsx