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 Apps
Answered

Validating method

(1) ShareShare
ReportReport
Posted on by 54
Hello all,
 
I have a page where a user can either fill in a few text boxes or upload a document.  Either will add to a collection.  Since some of the text boxes may be empty, I'm dealing with them as shown below.  Is there an easier way to do this?  The below works, but I wanted to validate in case there was a one-liner or alternate method to achieve the same thing.
 
Collect(colUserList, [{Name: txtUserName1.Text,Email: txtEmail1.Text},{Name: txtUserName2.Text,Email: txtEmail2.Text}, {Name: txtUserName3.Text,Email: txtEmail3.Text}]);
RemoveIf(colUserList, Or(IsBlank(Name), IsBlank(Email)));
Categories:
I have the same question (0)
  • Verified answer
    Michael E. Gernaey Profile Picture
    53,433 Super User 2025 Season 2 on at
    Hi,
     
    Do you just have like 6 text inputs on the screen??
     
    Here is another possibility.
     
    If you had a Gallery, in the gallery you added your 3 Text Inputs.
    Then you could make it show 3 rows (with no way to add or remove)
     
    Then you could do
    Now this for sure more lines, but accurately puts only the data you want in it, but how you have it, I have seen many people do. Its not wrong and you could of course, do the If clause in the Collect and make it one big line, it just gets ugly :-)
     
    ForAll(Gallery.AllItems,
        If(!IsBlank(ThisRecord.NameField.Text) And !IsBlank(ThisRecord.NextField.Text And !IsBlank(ThisRecord.NextField.Text),
        Collect(MyCollection,
          { 
             Name: ThisRecord.NameField.Text,
             Other: Thisrecord.OtherField.Text,
             OtherOther: ThisRecord.OtherOtherField.Text
          { 
        )
    );
    
    Technically you don't need to quality the ThisRecord in the Collect.
    
     
     

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

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 343 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard