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

Filter() delegation to SQL doesn't work properly

Hi,

 

When I use following syntax it gives me NO warning:

ClearCollect(collecton,Filter('[dbo].[PA_VIEW_VW]',USER_EMAIL=usr.Email));

 

When I use  following syntax it GIVES me a warrning and delegation is not working properly (not all rows are returned)

ClearCollect(collection,Filter('[dbo].[PA_VIEW_VW]',USER_EMAIL in otherCollection.emails));

This is not inline in  the article that Filter() function CAN be delegated.

IS there any workaround to check for more than 1 value? The number of records in

otherCollection.emails

 is non deterministic - it can be 1 or 10.

 

Regards,

KmL

9 REPLIES 9
Community Support Team
Community Support Team

Re: Filter() delegation to SQL doesn't work properly

Hi @KML,

 

The supported scenario for the in operator in SQL Server should be used as below, the right side of the in operator should be a column from the SQL Table:

 

Filter(DataBaseTable, "String" in Column)

Put the Column at the left side of the in operator is currently supported:

Filter(SQLTable, Column in [Values])

You may consider hold the SQL Table into a local collection, then do the filter as needed.

 

Regards,

Michael

Community Support Team _ Michael Shao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
KML
Level: Powered On

Re: Filter() delegation to SQL doesn't work properly

Hi @v-micsh-msft

 

Unfortunately your answer is misleading for me - you present 2 examples with different approach and I'm confused which one is correct or when I should utilize in which moment.

 

Let me once again put examples with errors as above examples doesn't work for me.

 

Set(usr,User());
ClearCollect(backupScope,'[dbo].[PA_BackupScope_VW]');
ClearCollect(otherCollection,Filter(backupScope,BACKUP_TO=usr.Email));
//NOT WORKING - POWERAPPS BUG
ClearCollect(usrCustCat,Filter('[dbo].[PA_UserScope_VW]',USER_EMAIL in otherCollection.emails))
//Part of this formula cannot be evaluated remotely. Right side of "in" operator is not a column name.

ClearCollect(usrCustCat,Filter('[dbo].[PA_UserScope_VW]',otherCollection.emails in USER_EMAIL))
//2 errors
//otherCollection.emails - Invalid argument type. Cannot use Table values in this context/
//Delegation warning. This part "Filter" of this formula might not work correctly on large data sets. The data source might not be able to process the formula and might return an incomplete data set. Your application might not return correct results or behave correctly if the data set is incomplete.

 

Please note that I'm using on-premises gateway.

 

Regards,

KmL

 

EDIT: I can't store '[dbo].[PA_UserScope_VW]' in a local collection as it has over 6000 rows.

 

 

dnndev
Level: Powered On

Re: Filter() delegation to SQL doesn't work properly

Hope the confusion gets clarified whether SQL supports delegable operator for IN or not. Can you please update the documentation with the good set of examples of how it works. 

 

Lots of forum answers/replies are misleading.

 

Will follow this post and watch for a solution by someone.

 

Thanks

DNN

KML
Level: Powered On

Re: Filter() delegation to SQL doesn't work properly

@v-micsh-msft

Hi,

 

Please test on "On-premises data gateway" not on Azure.

 

Regards,

KML

Pankaj_1993
Level: Powered On

Filter is through an error at the time of Screen Load

Hi All,

I developed a simple application and publish it. When i opened that app through my phone, I noticed that it has already a login page. So i thought , I would take those loginid and show data in the screen on the basis of loginid.

I am not Dynamics365 DataSource.

 

For this I used filter and Set currentuser details in the OnStart of the Screen1[Set(e,User())] and in the Screen1 I am using a Blank Vertical Gallery and I have written in the Items property [Filter(CustomerDeliveryStatusDatas_1,UserId=e.Email)]

 

 

Re: Filter() delegation to SQL doesn't work properly

I have the exact same issue. "CaseStatus" is a text column in the datasource.

 

Filter('[dbo].[Cases]',ComboBox1.SelectedItems.Value in CaseStatus && QueuePicker.Selected.QueueID = QueueID)

This line gives me the error "Cannot use table values in this context". If i swap the the column and the combo...

 

Filter('[dbo].[Cases]',CaseStatus in ComboBox1.SelectedItems.Value && QueuePicker.Selected.QueueID = QueueID)

...everything works as expected but i get the delegation warning.

 

If i change the combobox to a dropdown (or set "SelectMultiple" to false) everything works with delegation to SQL, so the problems is "in" but only in some cases.

 

Is this considered to be a bug or is it by design?

Administrator
Administrator

Re: Filter() delegation to SQL doesn't work properly

adding in someone to review. 

 

@TopShelf-MSFT 

LozzieD
Level: Powered On

Re: Filter() delegation to SQL doesn't work properly

Any feedback on this review yet?

 

I'm having similar issues.

LozzieD
Level: Powered On

Re: Filter() delegation to SQL doesn't work properly

So here's my three filters ...


Filter(
'[dbo].[Q2_ITEM_ANSWER]',
IGUID in '[dbo].[Q2_IA_UP_TGT]'.IGUID
)


Filter(
'[dbo].[Q2_ITEM_ANSWER]',
'[dbo].[Q2_IA_UP_TGT]'.IGUID in IGUID
)

Filter(
'[dbo].[Q2_ITEM_ANSWER]',
IGUID = 1
)

 

First gives delegation blue underline, second give table type red underline, and third works ok because it's "=" not "in".

 

Also, this is using Azure SQL, not DMG, so the issue seems to be the generic across both.

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
Users Online
Currently online: 369 members 6,467 guests
Please welcome our newest community members: