cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
AmDev
Continued Contributor
Continued Contributor

Use If Statement to Display Original Data Source or Collection

Hi

 

I am using an If statement to either show the original data source (in the initial view ) or a collection, if data has been added to that same collection. The truncated expression is as follows and works fine: 

 

If(
!IsEmpty(myCollection),
Filter(
myCollection... etc.. etc.. note in this true branch of the statement I am using the 'In' operator on the collection...
etc

etc

etc

,
MyOriginalData
)

 

The slight issue I'm having is, when this resolves to false and shows my original data source, it treats it as a non delagable query and loads in 500 items to the Gallery even though my false branch has no operators, just the data source - I thought for the false branch it would just load in a batch of 100 adn as I scroll if would bring in further batches of 100, right the way to the end of my data if I wanted (even though I wouldn't).

 

I appreciate I use the 'In' operator in the true branch of the expression, but that is being used on a collection and is on the true branch, so I didn't think it would impact delegation for the data source which is on the other branch.

 

Any pointers on this would be much appreciated.

 

Many thanks

Gerard

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @AmDev ,

The Delegation issue is that you have included the possibility that the collection is empty and filtered on the List, which then makes the in filter not Delegable (and consequently the whole statement the same. You could try the below and not get a Delegation warning however if the list is bigger than your Delegation limit, you will only get the first xxx number of records to filter.

With(
   {
      wList:
      If(
         IsEmpty(colStatusFilterGallery),
         TaskList
         colStatusFilterGallery
      )
   },
   SortByColumns(
      wList,
      (
         Len(ComboBox1.Selected.Value) = 0 ||
         Category.Value in ComboBox1.SelectedItems 
      ) && 
      (
         Len(ComboBox1_1.Selected.Value) = 0 ||
         Priority.Value in ComboBox1_1.SelectedItems 
      ) && 
	  (
         Len(ComboBox1_2.Selected.Value) = 0 ||
         Status.Value in ComboBox1_2.SelectedItems 
      ),
      "TaskID",
      Ascending
   )
)

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

View solution in original post

4 REPLIES 4
WarrenBelz
Super User
Super User

Hi @AmDev ,

Can you please post (in Text) the entire code. The in operator is certainly not Delegable, but used against a collection, this is not an issue - also what exactly is MyOriginalData

AmDev
Continued Contributor
Continued Contributor

Hey @WarrenBelz 

 

Thanks for coming back to me, sorry for the delay. I've pasted the full expression in there now. 'Myoriginaldata' is a SPO list called 'TaskList'

 

SortByColumns(
If(
IsEmpty(colTaskListFiltered),
TaskList,
Filter(
colTaskListFiltered,
If(
IsEmpty(colCategoryFilterGallery),
IsBlank(ComboBox1.Selected.Value) || IsEmpty(ComboBox1.SelectedItems) || Category.Value in ComboBox1.SelectedItems,
Category.Value in ComboBox1.SelectedItems
),
If(
IsEmpty(colPriorityFilterGallery),
IsBlank(ComboBox1_1.Selected.Value) || IsEmpty(ComboBox1_1.SelectedItems) || Priority.Value in ComboBox1_1.SelectedItems,
Priority.Value in ComboBox1_1.SelectedItems
),
If(
IsEmpty(colStatusFilterGallery),
IsBlank(ComboBox1_2.Selected.Value) || IsEmpty(ComboBox1_2.SelectedItems) || Status.Value in ComboBox1_2.SelectedItems,
Status.Value in ComboBox1_2.SelectedItems
)
)
),
"TaskID",
Ascending
)

 

Many thanks for having a look

Hi @AmDev ,

The Delegation issue is that you have included the possibility that the collection is empty and filtered on the List, which then makes the in filter not Delegable (and consequently the whole statement the same. You could try the below and not get a Delegation warning however if the list is bigger than your Delegation limit, you will only get the first xxx number of records to filter.

With(
   {
      wList:
      If(
         IsEmpty(colStatusFilterGallery),
         TaskList
         colStatusFilterGallery
      )
   },
   SortByColumns(
      wList,
      (
         Len(ComboBox1.Selected.Value) = 0 ||
         Category.Value in ComboBox1.SelectedItems 
      ) && 
      (
         Len(ComboBox1_1.Selected.Value) = 0 ||
         Priority.Value in ComboBox1_1.SelectedItems 
      ) && 
	  (
         Len(ComboBox1_2.Selected.Value) = 0 ||
         Status.Value in ComboBox1_2.SelectedItems 
      ),
      "TaskID",
      Ascending
   )
)

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

View solution in original post

AmDev
Continued Contributor
Continued Contributor

Thanks for the clarification and suggestion. Much appreciated 👍

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

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