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.
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!
Worked a treat 🙂 had to adapt slightly but thats what i was after . Could you explian the count if bit?
@hstep ,
or you set the numberinput Min value to 1
_____________________________________________________________________________________
Please give a thumbs up if I resolved your issue! Please click Accept as Solution to close the topic!
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!
WarrenBelz
791
Most Valuable Professional
MS.Ragavendar
410
Super User 2025 Season 2
mmbr1606
275
Super User 2025 Season 2