cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Sjj9166
Level: Powered On

Adding a radio button to my gallery Filter

Hello,

I'm attempting to add a radio control to my filter. Everything was working until I added the radio control

the onchange property of the control has this code:

If(Radio_Storetype.Selected.Value = "COR",Set(ThisType,"COR"),If(Radio_Storetype.Selected.Value = "LP3",Set(ThisType,"LP3")))

the item property of the gallery has this code 

Filter(HIERARCHY,(CM_Email=vCurrentUser.Email) &&
(StartsWith(StoreType,ThisType) &&
StartsWith(Store_id,TextSearchBox_1.Text) ||
StartsWith(STORE_NAME, TextSearchBox_1.Text) ||
StartsWith(CITY, TextSearchBox_1.Text))

)

When I play the app and change the radio, The gallery does not filter , it just shows all storetypes (COR and LP3)

What am I doing wrong?

Thanks

 

1 ACCEPTED SOLUTION

Accepted Solutions
v-siky-msft
Level 10

Re: Adding a radio button to my gallery Filter

Hi @Sjj9166 ,

 

Can you share more details with your logical judgement condition?

 

From your current logic statement, Items would be displayed whenever the following three criteria are met, so that result is not entirely up to StoreType.

1. (CM_Email=vCurrentUser.Email) && (StartsWith(StoreType,ThisType) && StartsWith(Store_id,TextSearchBox_1.Text)

2. StartsWith(STORE_NAME, TextSearchBox_1.Text) 

3. StartsWith(CITY, TextSearchBox_1.Text)

 

Please note the order of judgment of the logical operators, && 's priority is higher than OR

you should modify your formulas as below:

Filter(HIERARCHY,(CM_Email=vCurrentUser.Email) &&
(StartsWith(StoreType,ThisType) &&
(StartsWith(Store_id,TextSearchBox_1.Text) ||
StartsWith(STORE_NAME, TextSearchBox_1.Text) ||
StartsWith(CITY, TextSearchBox_1.Text))
))

Best regards,

Sik

 

View solution in original post

2 REPLIES 2
Super User
Super User

Re: Adding a radio button to my gallery Filter

If I understand the issue correctly I think it can be fixed by making a small change to the operator precedence.

Try this:

Filter(HIERARCHY,(CM_Email=vCurrentUser.Email) &&
(StartsWith(StoreType,ThisType) &&
(StartsWith(Store_id,TextSearchBox_1.Text) ||
StartsWith(STORE_NAME, TextSearchBox_1.Text) ||
StartsWith(CITY, TextSearchBox_1.Text)))
)


--------------------------------------------------------------------------------
If this post helps answer your question, please click on “Accept as Solution” to help other members find it more quickly. If you thought this post was helpful, please give it a Thumbs Up.
v-siky-msft
Level 10

Re: Adding a radio button to my gallery Filter

Hi @Sjj9166 ,

 

Can you share more details with your logical judgement condition?

 

From your current logic statement, Items would be displayed whenever the following three criteria are met, so that result is not entirely up to StoreType.

1. (CM_Email=vCurrentUser.Email) && (StartsWith(StoreType,ThisType) && StartsWith(Store_id,TextSearchBox_1.Text)

2. StartsWith(STORE_NAME, TextSearchBox_1.Text) 

3. StartsWith(CITY, TextSearchBox_1.Text)

 

Please note the order of judgment of the logical operators, && 's priority is higher than OR

you should modify your formulas as below:

Filter(HIERARCHY,(CM_Email=vCurrentUser.Email) &&
(StartsWith(StoreType,ThisType) &&
(StartsWith(Store_id,TextSearchBox_1.Text) ||
StartsWith(STORE_NAME, TextSearchBox_1.Text) ||
StartsWith(CITY, TextSearchBox_1.Text))
))

Best regards,

Sik

 

View solution in original post

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors (Last 30 Days)
Users online (5,212)