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 / If statement inside Fo...
Power Apps
Answered

If statement inside ForAll

(0) ShareShare
ReportReport
Posted on by 1,247 Super User 2024 Season 1

This is how my data looks. I am using two ForAll loops to extract the multiline data into individual rows.

Anonymous_Hippo_0-1653583628118.png

The below formula works well, But unfortunately when Deficiency # column is blank it ignore that row since no value is returned.

 

ForAll(
 col_Sample,
 ForAll(
 Split(
 'Deficiency #',
 Char(10)
 ),
 Collect(
 Test2121,
 {
 ID: ID,
 Drid: Result,
 DrRDate: Last(
 FirstN(
 Split(
 'DR Received Date',
 Char(10)
 ),
 Value(Result)
 )
 ).Result
 }
 )
 )
);

 

I would like to add a single row with the ID number added in the scenario when the spit function returns an empty table. How can this be done 🙂 Not able to figure this one out.... this feels very easy though 😫

 

Thank you !!!!

 

Categories:
I have the same question (0)
  • Verified answer
    rubin_boer Profile Picture
    4,843 Super User 2024 Season 1 on at

    hi @Anonymous_Hippo try replacing 

     

     Split(
     'Deficiency #',
     Char(10)
     )

     

     

    With

    Split(Coalesce('Deficiency #',"0"),Char(10))

     

    Maybe give index a shot as well for

     

    Last(
     FirstN(
     Split(
     'DR Received Date',
     Char(10)
     ),
     Value(Result)
     )
     ).Result

     

     

    Index(Split('DR Received Date',Char(10)), Value(Result)).Result

     

    Test Run:

    Button OnSelect:

    ClearCollect(
     colFunky,
     Table(
     {
     name: "test 1",
     check: "1
    2
    3",
     val: "abc
    cde
    edf"
     },
     {
     name: "test 2",
     check: "",
     val: "klm
    mno
    pqr"
     }
     )
    );
    Clear(colWhoop);
    ForAll(
     colFunky,
     ForAll(
     Split(
     Coalesce(
     check,
     "0"
     ),
     Char(10)
     ),
     Collect(
     colWhoop,
     {
     rName: name,
     rCheck: Result,
     rVal: Index(
     Split(
     val,
     Char(10)
     ),
     Value(Result)
     ).Result
     }
     )
     )
    )

     

    colFunky

    rubin_boer_0-1653594146766.png

     

    ColWhoop

    rubin_boer_1-1653594177751.png

     

    The blank is also added

     

    Hope it helps,

    R

     

  • Anonymous_Hippo Profile Picture
    1,247 Super User 2024 Season 1 on at

    @rubin_boer  Your solution was not HELPFUL

    .

    .

    .

    .

    because it was SUPER HELPFUL 🙌

    Index function is new to me thank you for that as well !!!

    Thank you !! 😁

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 March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 530

#2
WarrenBelz Profile Picture

WarrenBelz 459 Most Valuable Professional

#3
Haque Profile Picture

Haque 314

Last 30 days Overall leaderboard