Hi All
Was hoping someone could help I have some code which runs on the "onstart" event of a PowerApps
and the variable "varStartDate" fails initialize. The "varUser" initializes but is null when ever called
Please note the loop work perfectly when a value for varStartDate is hard coded can anyone suggest what is wrong or how I might get pass it
-------------------- Code --------------------------------------------------------------
Set(varUser,User());
//get the date of last monday
Set(varStartDate,DateAdd(Today(),
If(Weekday(Today())=1,-6,
Weekday(Today())=2,0,
Weekday(Today())=3,-1,
Weekday(Today())=4,-2,
Weekday(Today())=5,-3,
Weekday(Today())=6,-4,
Weekday(Today())=7,-5
)
);
Clear(NextDates);
ClearCollect(Loop,{Index:0},{Index:1},{Index:2},{Index:3},{Index:4},{Index:5},{Index:6},{Index:7});
//load the NextDates Collection
ForAll(
Filter(Loop,Index<=6),
Collect(NextDates,
{
Date:DateAdd(DateTimeValue(varStartDate),Index,Days),
DaysSincePickedDate:Index,
DayOfWeek:Weekday(DateAdd(DateTimeValue(varStartDate),Index,Days))
}
));
//last week
ClearCollect(Mondays,{MDay:Text(DateAdd(DateTimeValue(varStartDate),-7),"dd-mm-yyyy")});
//This week
Collect(Mondays,{MDay:Text(DateTimeValue(varStartDate),"dd-mm-yyyy")});
//Next Week
Collect(Mondays,{MDay:Text(DateAdd(DateTimeValue(varStartDate),7),"dd-mm-yyyy")});
------------------------ Code End ----------------------------------------------------------------------------

Report
All responses (
Answers (