Skip to main content
Community site session details

Community site session details

Session Id : 6FREBixdQkogLdgXVNT18J
Power Apps - Building Power Apps
Unanswered

If conditions in a gallery with input

Like (0) ShareShare
ReportReport
Posted on 8 May 2024 15:00:59 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. 

 

  • LaurensM Profile Picture
    12,510 Moderator on 08 May 2024 at 15:45:31
    Re: If conditions in a gallery with input

    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!

  • hstep Profile Picture
    on 08 May 2024 at 15:38:23
    Re: If conditions in a gallery with input

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

  • Gochix Profile Picture
    1,933 Moderator on 08 May 2024 at 15:22:04
    Re: If conditions in a gallery with input

    @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!

  • LaurensM Profile Picture
    12,510 Moderator on 08 May 2024 at 15:16:17
    Re: If conditions in a gallery with input

    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!

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

Announcing our 2025 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for…

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 791 Most Valuable Professional

#2
MS.Ragavendar Profile Picture

MS.Ragavendar 410 Super User 2025 Season 2

#3
mmbr1606 Profile Picture

mmbr1606 275 Super User 2025 Season 2

Loading started
Loading complete