I know there have been other threads about this topic, but they either confuse me or don't work in my case.
I have a table in excel where there are 10 rows for every month, and I have set up a grouping system. User can for ex. set up group 1 for January, February, March and then set up group 2 to contain every other month. In this case the app needs to assign 30 rows of January, February and March to group 1 and the remaining 90 to group 2. There can be a maximum of 12 groups.
The problem arises when I need to get those numbers assigned to the Table. I have a Month and Index column. Index should have the number of the group the specfic month is assigned to but simply isn't changing.
Here are the commands I tried and assigned to a button:
ForAll(Filter(Table, Month = "January"), Patch(Table, LookUp(Table, Month = "January"), {Index: Value(variable)}))
Collect(Jan, Filter(Table, Month = "January"));
UpdateIf(Jan, true, {Index: Value(variable)});
Patch(Table,Jan) variable here is set by the user when they select a group to modify. That way the button knows which group should be edited.
These commands are a part of a bigger command chain, which looks something like this:
If(Toggle1.Value = true && Checkbox1.= true, ForAll(Filter(Table, Month = "January"), Patch(Table, LookUp(Table, Month = "January"), {Index: Value(variable)})), Set(dummy, false));
If(Toggle1.Value = true && Checkbox2.= true, ForAll(Filter(Table, Month = "February"), Patch(Table, LookUp(Table, Month = "February"), {Index: Value(variable)})), Set(dummy, false));
...Toggle1 checks if the group should be active, Checkbox1 checks if the selected month should be a part of this group and dummy is just there to skip the else value. I don't want the app to do anything if the conditions aren't met. There would be 12 commands corresponding to every month.
I still don't fully understand how ForAll and Collect work. It certainly doesn't help that in ForAll I need to reference a table three times and the first one for some reason has to be different and Collect creates an empty collection even through I made sure that the condition was written correctly.
So, how do I put these group numbers to assigned months?