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

Mammoth of a visible variables etc.

Hi,

 

I have a question type canvas app with sharepoint as the datasource

 

In my app is around 30 radio buttons with the items ["OK","N/A","Defect"]

i then have a double check radio button with the items ["Yes","No"] and i have two Onselect buttons ill call camerabutton and another savebutton

 

once my users has answered every question and if they selected all OK and/or N/A in the questionaire id like for just the savebutton to be visible, however if the user selects one or more Defects in the questionaire id like for the Double check radio button to be visible and then if they select "Yes" on the double check radio button then the savebutton appears (and if they change that question from defect to OK to NA the double check disappears and the save button reappears) and if they select No on the double check radio button id like the camerabutton to appear,


I have tried so many many variables and options however im running around in circles, could someone please set me straight>?

Thankyou

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted

Hi @Questionasking ,

I've found that you posted another issue.

I've answered you in that issue, please refer that:
https://powerusers.microsoft.com/t5/Building-Power-Apps/Visible-Variables-multiple-conditions/td-p/6...

 

 

 

Best regards,

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

5 REPLIES 5
Highlighted
Super User II
Super User II

Probably the simplest pattern is to collect any negative response, and then base your eventual show/hide on whether or not there is a negative response in the collection.

 

To do this, you'll want to 'key' or have a way to identify each individual Radio button (for adding/removing a row from the negative collection). Simplest way to is just collect the Self property, so you don't have to track/add anything. It's less useful if you actually wanna use the objects in the collection, but we just want counts.

Set this to the OnChange property on all of your question radio buttons

If(
    Self.SelectedText.Value = "Defect", // Your 'negative' outcome,
    Collect(
        colNegativeResponse,
        {responseKey: Self}
    ),
    RemoveIf(
        colNegativeResponse,
        responseKey = Self
    )
)

 

This will insert a row into a collection (colNegativeResponse) if the negative response is selected for that control. It will also remove it, if the value is reverted.

 

Then you can simply do a IsEmpty(colNegativeResponse) or CountRows(colNegativeResponse) function to figure out if you have any negative responses (or how many).

 

You can elaborate on this logic, as needed, but this will account for your 30+ values.

Highlighted
Community Support
Community Support

Hi @Questionasking ,

Do you mean that:
1)all items are selected for OK and/or N/A, savebutton will be visible?

2)if the user selects one or more Defects, Double check radio button to be visible?

3)for double check radio button, if they select "Yes", then the savebutton appears

                                                     if they select "No", then camerabutton to appear?

If so, I've made a similar test for your reference:

1)gallery named Gallery1, radio inside gallery named Radio1(["OK","N/A","Defect"]), radio outside gallery named Radio2( ["Yes","No"])

2)set Radio1's Items:

 

["OK","N/A","Defect"]

 

Radio1's OnChange:

 

Reset(Radio2)

 

3)save button's Visible:

 

If(
    (IsEmpty(
        Filter(
            Gallery1.AllItems,
            "Defect" = Radio1.SelectedText.Value
               )
              ) ||   //no "Defect"
      Radio2.SelectedText.Value = "Yes"   //radio select yes
     ) && 
     IsEmpty(
        Filter(
            Gallery1.AllItems,
            IsBlank(Radio1)
              )
            ),          //all items has selected selection
    true,
    false
)

 

4)Radio2's Items:

 

["Yes","No"]

 

Radio2's Visible:

 

If(
    !IsEmpty(
        Filter(
            Gallery1.AllItems,
            "Defect" = Radio1.SelectedText.Value
               )
              ) &&    //select "Defect"
      IsEmpty(
        Filter(
            Gallery1.AllItems,
            IsBlank(Radio1) 
               )
             ),     //all items has selected selection
    true,
    false
)

 

5)camera button's Visible:

 

Radio2.SelectedText.Value="No"

 

923.gif

 

 

 

Best regards,

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Highlighted


@v-yutliu-msft wrote:

Hi @Questionasking ,

Do you mean that:
1)all items are selected for OK and/or N/A, savebutton will be visible?

2)if the user selects one or more Defects, Double check radio button to be visible?

3)for double check radio button, if they select "Yes", then the savebutton appears

                                                     if they select "No", then camerabutton to appear?

If so, I've made a similar test for your reference:

1)gallery named Gallery1, radio inside gallery named Radio1(["OK","N/A","Defect"]), radio outside gallery named Radio2( ["Yes","No"])

2)set Radio1's Items:

 

 

["OK","N/A","Defect"]

 

 

Radio1's OnChange:

 

 

Reset(Radio2)

 

 

3)save button's Visible:

 

 

If(
    (IsEmpty(
        Filter(
            Gallery1.AllItems,
            "Defect" = Radio1.SelectedText.Value
               )
              ) ||   //no "Defect"
      Radio2.SelectedText.Value = "Yes"   //radio select yes
     ) && 
     IsEmpty(
        Filter(
            Gallery1.AllItems,
            IsBlank(Radio1)
              )
            ),          //all items has selected selection
    true,
    false
)

 

 

4)Radio2's Items:

 

 

["Yes","No"]

 

 

Radio2's Visible:

 

 

If(
    !IsEmpty(
        Filter(
            Gallery1.AllItems,
            "Defect" = Radio1.SelectedText.Value
               )
              ) &&    //select "Defect"
      IsEmpty(
        Filter(
            Gallery1.AllItems,
            IsBlank(Radio1) 
               )
             ),     //all items has selected selection
    true,
    false
)

 

 

5)camera button's Visible:

 

 

Radio2.SelectedText.Value="No"

 

 

923.gif

 

 

 

Best regards,


None of my questions are in a gallery, they are all on one canvas app with radio buttons, the design i had to replicate made the app to be made this way.

Highlighted

Hi @Questionasking ,

So you did not display question list in one gallery?
Then how do you display those questions? By using what controls?
Sorry that I could not image your app's design.

Could you show me screen shoot of your app to help me understand?

 

 

Best regards,

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Highlighted

Hi @Questionasking ,

I've found that you posted another issue.

I've answered you in that issue, please refer that:
https://powerusers.microsoft.com/t5/Building-Power-Apps/Visible-Variables-multiple-conditions/td-p/6...

 

 

 

Best regards,

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Community Highlights

Community Highlights

Check out the Power Platform Community Highlights

Top Solution Authors
Top Kudoed Authors
Users online (1,661)