
Hello,
i tried to implement this code to sum all items for each day in the range of the Datepicker. So each record in the collection should show the sum of all items seperated of one day.
ClearCollect(WeekSummaryOrder);;
ForAll(
Sequence(DateDiff(DatePicker1_2.SelectedDate; DatePicker1_4.SelectedDate; TimeUnit.Days) + 1);
Collect(
WeekSummaryOrder;
{
Date: DateAdd(DatePicker1_2.SelectedDate; Value - 1; TimeUnit.Days);
MainDish1Count: CountRows(Filter(Gallery1_1.AllItems; MainDish = "Hauptgericht 1" && Date = DateAdd(DatePicker1_2.SelectedDate; Value - 1, TimeUnit.Days)));
MainDish2Count: CountRows(Filter(Gallery1_1.AllItems; MainDish = "Hauptgericht 2" && Date = DateAdd(DatePicker1_2.SelectedDate; Value - 1, TimeUnit.Days)));
MainDish3Count: CountRows(Filter(Gallery1_1.AllItems; MainDish = "Hauptgericht 3" && Date = DateAdd(DatePicker1_2.SelectedDate; Value - 1, TimeUnit.Days)));
}
)
);
Thanks in advance!
Hi @Bajda,
Try including a reference to the current item in the ForAll loop (ThisRecord):
ClearCollect(WeekSummaryOrder);;
ForAll(
Sequence(DateDiff(DatePicker1_2.SelectedDate; DatePicker1_4.SelectedDate; TimeUnit.Days) + 1);
Collect(
WeekSummaryOrder;
{
Date: DateAdd(DatePicker1_2.SelectedDate; ThisRecord.Value - 1; TimeUnit.Days);
MainDish1Count: CountRows(Filter(Gallery1_1.AllItems; MainDish = "Hauptgericht 1" && Date = DateAdd(DatePicker1_2.SelectedDate; ThisRecord.Value - 1, TimeUnit.Days)));
MainDish2Count: CountRows(Filter(Gallery1_1.AllItems; MainDish = "Hauptgericht 2" && Date = DateAdd(DatePicker1_2.SelectedDate; ThisRecord.Value - 1, TimeUnit.Days)));
MainDish3Count: CountRows(Filter(Gallery1_1.AllItems; MainDish = "Hauptgericht 3" && Date = DateAdd(DatePicker1_2.SelectedDate; ThisRecord.Value - 1, TimeUnit.Days)));
}
)
);