I have a problem with a groupby-filter combination in a timekeeping app.
I have a screen where the user can select a period, a hidden control contains the username. A gallery shows the hours per day for the user in the selected period, using a GroupBy and Filter. Working fine.
In the screen's OnVisible I use essentially the same code to show last week's hours so the gallery is filled when the user opens the screen (so the only difference is the code for the time period). However, in this case it refuses to filter on the username, and shows the hours per day for all users.
I tried a filter on the main table in advance, but even then, the RegelsPerDag collection shows all users.
My code:
UpdateContext({
DatumVanVullen:DateAdd(Today(), -1 * (Weekday(Today(), Monday) - 1)-7, Days),
DatumTotVullen:DateAdd(Today(), -Weekday(Today(), Monday), Days)});
ClearCollect( RegelsPerDag, GroupBy( Filter(tblTijdschrijfregel, MedewerkerAccessID= MijnMedewerkerAccessID, Datum >= DatumVanVullen, Datum < DatumTotVullen), "Datum", "Regels" ) );
ClearCollect( SomUrenPerDag, AddColumns( RegelsPerDag, "Uren", Sum(Regels, TijdsduurGewogenIntern ) ) );
ClearCollect( UrenPerDag, DropColumns(SomUrenPerDag, "Regels"));
Any idea what may be causing this weird behaviour in the onVisible? I'm stumped, because the code works correctly when started from the controls on the screen.