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 / 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,841 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

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 711 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 319 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard