Hey guys,
I have the following problem. I want to create a table that looks like the following. My problem is, that number of parts is based on a form value (let's say the user can choose between 1 and 5 parts per order). So normally I would use two for loops, the first one loops over the number of stations (in my production 1 to 6) and the second loop over the number of parts the customer selected.
Order | Station | Part |
HTW-0017 | 1 | 1 |
HTW-0017 | 2 | 1 |
HTW-0017 | 3 | 1 |
HTW-0017 | 4 | 1 |
HTW-0017 | 5 | 1 |
HTW-0017 | 6 | 1 |
HTW-0017 | 1 | 2 |
HTW-0017 | 2 | 2 |
HTW-0017 | 3 | 2 |
HTW-0017 | 4 | 2 |
HTW-0017 | 5 | 2 |
HTW-0017 | 6 | 2 |
ForAll(
Sequence(CountRows(Tabelle5)) /* The number of stations I have in my production */ ;
ForAll(
Sequence(DataCardValue40.SelectedText.Value) /* The number of parts the customer ordered */;
Patch(
Tabelle1;
Defaults(Tabelle1);
{
Auftrag: Auftragsnummer; /* Order Number */
Station: zaehler /*My Variable for the iterator, which isn't working/;
Teil: Value /* The iterator which is working fine, for the second sequence*/;
Status: "Nicht gestartet"
};;
)
)
)
I tried using a iterator, unfortunately you can't update context within ForAll. Any suggetstions how I could solve that?
Oh gosh, thank you so much!
Hi @dnhrtmn
You can us an alias using AS to name your ForAll loop so that PowerApps know which loop you are referring to.
Example:
ForAll(
Sequence(CountRows(Tabelle5)) As Loop1 /* The number of stations I have in my production */ ;
ForAll(
Sequence(DataCardValue40.SelectedText.Value) As Loop2 /* The number of parts the customer ordered */;
Patch(
Tabelle1;
Defaults(Tabelle1);
{
Auftrag: Auftragsnummer; /* Order Number */
Station: Loop1.Value
Teil: Loop2.Value /* The iterator which is working fine, for the second sequence*/;
Status: "Nicht gestartet"
};;
)
)
)
WarrenBelz
89
Most Valuable Professional
MS.Ragavendar
54
Michael E. Gernaey
42
Super User 2025 Season 1