web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Two For Loops with ForAll
Power Apps
Answered

Two For Loops with ForAll

(0) ShareShare
ReportReport
Posted on by 7

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.

 

OrderStationPart
HTW-001711
HTW-001721
HTW-001731
HTW-001741
HTW-001751
HTW-001761
HTW-001712
HTW-001722
HTW-001732
HTW-001742
HTW-001752
HTW-001762

 

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? 

Categories:
I have the same question (0)
  • Verified answer
    Adrian_Celis Profile Picture
    1,652 Moderator on at

    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"
    };;
    )
    )
    )

     

  • dnhrtmn Profile Picture
    7 on at

    Oh gosh, thank you so much!

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 721 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 320 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard