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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Nested ForAll() How to...
Power Apps
Answered

Nested ForAll() How to pass ThisRecord from first level to second.

(0) ShareShare
ReportReport
Posted on by 3,347

I need to know how to make 'ThisRecord._SNValve work in a nested ForAll()

 

 

 

ClearCollect(NextDataItems,
 FirstN(
 Filter( temporary_assign_wo, Updated<>2 && !IsBlank(_SNValve) ),
 Value(TextInput6.Text)));

ForAll(NextDataItems.Index,Patch(NextDataItems,ThisRecord,{SN_List:Match(
 Concat(
 ForAll(
 TrimEnds(
 Split(
 Substitute(ThisRecord._SNValve,";",","),
 ","
 )
 ).Result,
 If(
 IsBlank(Find("-",ThisRecord.Result)),
 ThisRecord.Result,
 If(SN_Prefix_2.Text="",
 
 Match(Concat(
 Sequence(Value(Last(Split(ThisRecord.Result,"-").Result).Result)-Value(First(Split(ThisRecord.Result,"-").Result).Result)+1,
 Value(First(Split(ThisRecord.Result,"-").Result).Result),1).Value,
 Concatenate(Text(Value),",")
 ),
 "^(?<trim>.*),$"
 ).trim,
 Match(Concat(
 Sequence(Value(Last(Split(Last(Split(ThisRecord.Result,"-").Result).Result,SN_Prefix_2.Text)).Result)-Value(Last(Split(First(Split(ThisRecord.Result,"-").Result).Result,SN_Prefix_2.Text)).Result)+1,
 Value(Last(Split(First(Split(ThisRecord.Result,"-").Result).Result,SN_Prefix_2.Text)).Result),1).Value,
 Concatenate(SN_Prefix_2.Text,Text(Value),",")
 ),
 "^(?<trim>.*),$"
 ).trim
 ))
 ),
 Concatenate(Value,",")
 ),
 "^(?<trim>.*),$"
 ).trim}))

 

I have an issue with the Substitute() statement.  I get this:

martinav_0-1633647818760.png

The statement works in the context of a label in a gallery.  I pulled this out of the gallery, and had to change a couple elements.  It all looks good except for this.  

 

Categories:
I have the same question (0)
  • Verified answer
    BCLS776 Profile Picture
    8,994 Moderator on at

    Have you tried working the As operator into your code to help with scope:?

    ForAll(NextDataItems.Index As aItem,Patch(NextDataItems,aItem,{SN_List:Match(
     Concat(
     ForAll(
     TrimEnds(
     Split(
     Substitute(aItem._SNValve,";",","),
     ","
     )
    .
    .
    .
    

    You can use unique As references for each nested ForAll to give context that ThisRecord can't do on its own.

     

    Hope that helps,

    Bryan

     

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Vish WR Profile Picture

Vish WR 742

#2
Valantis Profile Picture

Valantis 474

#3
Haque Profile Picture

Haque 358

Last 30 days Overall leaderboard