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.

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