cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper II
Helper II

If function for all items in a gallery

I want my save button to appear only after all the gallery items have had their met radio button selected. My current visible formula for the save button achieves this, but only for the first gallery item. (Note: this gallery does not consist of records from a data source; once the save button is selected, it will create the records)

 

If(IsBlank(radio_metIND.selected.value), false, true)

 

Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Super User
Super User

Re: If function for all items in a gallery

@ALZamora 

Set your Visible property on your button to the following:

!(Sum(yourGalleryName.AllItems, If(IsBlank(Radio_metIND.Selected.Value), 1, 0))>0)

That will do a sum of all the Radio buttons - casting them as, if blank then 1 otherwise 0. 

So, if (let's say you have 5 records) they are all blank (not selected) then the sum would be 5, which is greater then 0, thus true.  Since you want the visible property to be when that condition is NOT true, then we put a ! in the front.

 

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.

View solution in original post

3 REPLIES 3
Highlighted
Advocate III
Advocate III

Re: If function for all items in a gallery

can you use if condition with "OR"( "||" )operator and write a condition for all items?

if this condition gets true then you can set button's visiblity to true.

 

Assume there is 3 items,

1. radio_metIND1

2.radio_metIND2

3. radio_metIND3

 

If(
IsBlank(radio_metIND1.Selected.Value) ||
IsBlank(radio_metIND2.Selected.Value) ||
IsBlank(radio_metIND3.Selected.Value)
,
false
, true)

So using above condition-- if anyone of the radio is not selected(Blank condition) then your button will be hide,

And if all the radio button is selected then button will be visible.

 

you can also use "AND" ("&&") operator here.

in that case using the same items your condition will be like this:

If(
!IsBlank(radio_metIND1.Selected.Value) &&
!IsBlank(radio_metIND2.Selected.Value) &&
!IsBlank(radio_metIND3.Selected.Value)
,
true
, false)

So here if all the buttons are selected(Not Blank condition) then and then only your button will be visible else it will be hidden.

Let me know if you have any query.

 

Mark this as a solution if really helps you.

 

Thanks,

Milansinh Raj

Highlighted
Advocate III
Advocate III

Re: If function for all items in a gallery

can you use if condition with "OR"( "||" )operator and write a condition for all items?

if this condition gets true then you can set button's visiblity to true.

 

Assume there is 3 items,

1. radio_metIND1

2.radio_metIND2

3. radio_metIND3

 

If(
IsBlank(radio_metIND1.Selected.Value) ||
IsBlank(radio_metIND2.Selected.Value) ||
IsBlank(radio_metIND3.Selected.Value)
,
false
, true)

So using above condition-- if anyone of the radio is not selected(Blank condition) then your button will be hide,

And if all the radio button is selected then button will be visible.

 

you can also use "AND" ("&&") operator here.

in that case using the same items your condition will be like this:

If(
!IsBlank(radio_metIND1.Selected.Value) &&
!IsBlank(radio_metIND2.Selected.Value) &&
!IsBlank(radio_metIND3.Selected.Value)
,
true
, false)

So here if all the buttons are selected(Not Blank condition) then and then only your button will be visible else it will be hidden.

Let me know if you have any query.

 

Mark this as a solution if really helps you.

 

Thanks,

Milansinh Raj

Highlighted
Super User
Super User

Re: If function for all items in a gallery

@ALZamora 

Set your Visible property on your button to the following:

!(Sum(yourGalleryName.AllItems, If(IsBlank(Radio_metIND.Selected.Value), 1, 0))>0)

That will do a sum of all the Radio buttons - casting them as, if blank then 1 otherwise 0. 

So, if (let's say you have 5 records) they are all blank (not selected) then the sum would be 5, which is greater then 0, thus true.  Since you want the visible property to be when that condition is NOT true, then we put a ! in the front.

 

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.

View solution in original post

Helpful resources

Announcements
secondImage

Demo-Extravaganza 2020

Check out these cool Power Apps & vote on your favorite!

secondImage

Robotic Process Automation

Let's talk about the solution provided by Microsoft for Robotic Process Automation (RPA)

secondImage

Community Highlights

Check out whats happening in Power Apps

secondImage

Community User Group Member Badges

FIll out a quick form to claim your community user group member badge today!

Top Solution Authors
Top Kudoed Authors
Users online (7,101)