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

Filter Gallery with Combobox and Toggle

Hi,

This should be simple but I am struggling.

I am loading a Gallery from a SQL table CustSite and the filter on selecting a Province is working.

I now want to select either Account Customers (CustId starts with "D") or Cash Customer(CustId starts with "C")

 

The code on the Gallery Items:

 

Filter('[dbo].[PA_Customers]',Province=cmbProv.Selected.Value,If(Toggle1.Value = false,StartsWith(CustId,"C"),StartsWith(CustId,"D")))

 

No data is Showing.

Please help.

3 REPLIES 3
Super User
Super User

Re: Filter Gallery with Combobox and Toggle

@SoftSpot 

 

Try to change that formula for your Gallery Items property to this:

Filter('[dbo].[PA_Customers]',
Province=cmbProv.Selected.Value && StartsWith(CustId,If(Toggle1.Value, "D","C"))
)

See if you have any luck with that.  If not, try to remove the && StartsWith... portion of the filter and see if you are even getting any results with just the ComboBox value.

_____________________________________________________________________________________
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.
Community Support Team
Community Support Team

Re: Filter Gallery with Combobox and Toggle

HI @SoftSpot ,

Based on the formula that you provided, I do not find any syntax error with it.

 

Please consider take a try to modify your formula as below:

If(
   Toggle1.Value = false,
   Filter('[dbo].[PA_Customers]',Province=cmbProv.Selected.Value, StartsWith(CustId,"C")),
Filter('[dbo].[PA_Customers]',Province=cmbProv.Selected.Value, StartsWith(CustId,"D")) )

In addition, please also make sure that the result the Filter('[dbo].[PA_Customers]',Province=cmbProv.Selected.Value) formula returns contains records whose CustId column value starts with "D" or "C".

 

Best regards,

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

Re: Filter Gallery with Combobox and Toggle

Thanks for posting in the community @SoftSpot - can you review the above replies and update the thread if they were helpful? 

 

Thank you,

 

@TopShelf-MSFT 

Helpful resources

Announcements
firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Top Community Contributors for July 2019

Top Community Contributors for July 2019

Let's thank our top community contributors

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

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

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

FifthImage

Dynamics 365 and Power Platform April 2019 Release notes

Features releasing from April 2019 through September 2019!

SixthImage

Power Summit Australia 2019

August 20-23rd 2019

Users Online
Currently online: 194 members 4,606 guests
Please welcome our newest community members: