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 conditions in a gal...
Power Apps
Unanswered

If conditions in a gallery with input

(0) ShareShare
ReportReport
Posted on by

hi guys, i have a gallery that im using a bit like a form , ive added 3 input buttons to each entry in the gallery , numberinput 1 2 & 3

 

is there any way to preform a validation to make sure that the value in each field is above 0 ? ive tried for alls etc , when submitting i create a collecteion and patch all the values into a sharepoint. 

 

Categories:
I have the same question (0)
  • LaurensM Profile Picture
    12,516 Moderator on at

    Hi @hstep,

     

    You can count all rows where at least one of the inputs equals or is less than 0. In the code below I used the classic TextInput control - should you use the modern control, change .Text with .Value:

     

    If(
     //Adjust gallery and text input names accordingly
     CountIf(
     Gallery1.AllItems,
     //For NumberInput control use: 
     //NumberInput1.Value <= 0 || NumberInput2.Value <= 0 || NumberInput3.Value <= 0
     Value(TextInput1.Text) <= 0 || Value(TextInput2.Text) <= 0 || Value(TextInput3.Text) <= 0
     ) = 0,
     ClearCollect(), //Your code here
     Notify("Input values should exceed 0.", NotificationType.Error, 5000)
    )

     

    If this solves your question, would you be so kind as to accept it as a solution & give it a thumbs up.

    Thanks!

  • Gochix Profile Picture
    1,935 Moderator on at

    @hstep ,

     

    or you set the numberinput Min value to 1

    Gochix_0-1715181701187.pngGochix_1-1715181713777.png


    _____________________________________________________________________________________
    Please give a thumbs up if I resolved your issue! Please click Accept as Solution to close the topic!

  • hstep Profile Picture
    on at

    Worked a treat 🙂 had to adapt slightly but thats what i was after . Could you explian the count if bit?

  • LaurensM Profile Picture
    12,516 Moderator on at

    Glad we were able to help @hstep 😊

     

    The CountIf function counts all records that meet the condition parameter - returning a number as output.

    CountIf(
     <Datasource>,
     <Filter condition>
    ) 

     

    In our case, we count all rows within the gallery for which at least one of the number input controls is equal to or less than 0. The ClearCollect code only runs if no rows contain 0 as a value (CountIf returns 0).

     

    I hope this helps!

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!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 549 Most Valuable Professional

#2
Kalathiya Profile Picture

Kalathiya 225 Super User 2026 Season 1

#3
Haque Profile Picture

Haque 224

Last 30 days Overall leaderboard