"For Each Item" SmartForm rule on a paginated List View?


Badge +4

I'm running into an issue when using the "For each item in a List View" rule on a List View that has pagination enabled.

 

I have the following:

  • A List View that contains many items
  • The List View is configured with "Enable Paging with 15 items per page"
  • I am using the "For each item in a List View" rule, setup as "for All items"

 

I am expecting to loop thru all items the List View is holding, including the items that are on page 1, page 2, page 3 and so on.  What happens, though, is it only loops thru all items the List View is currently displaying.  If I am on Page 1, it only loops thru the 15 items on page 1.  If I am on Page 2, it only loops thru the 15 items on page 2.

 

Does anyone know how to get K2 to loop thru ALL the items the List View is holding?

 

What I'm attempting to do:  I need to know the exact items the user has displayed in their List View, which can change depending on how they setup filters and ordering.  If they apply a filter that shows only half the items, and then order by the second column, I need to get a list of those items and only those items filtered and sorted the same way.

 

Thanks


2 replies

Userlevel 1
Badge +8

Hi Chris

 

Not sure this is possible, certainly not out of the box.

 

Only suggestion I can make is to:

  1. change the listview to be not paginated, but this may obviously make the form very long
  2. do the looping in your source system (e.g. via  a SQL stored procedure). To do this you may need to implement your own filtering, as you cannot capture the filter the user enters in the OOTB listview filter. Not sure what you could do about the column ordering if that is required.
Badge +4

Hi Andrew,

 

Thanks for the info.  After posting this and doing more research, it does appear to be impossible OOB.  My understanding is that it's not loading all data into the List View and then simply splitting it up into 15 item pages, it's actually only returning 15 items at a time from the server, so the List View really does only have 15 items at a time.  I guess this is also why you can't change the pagination size at runtime.

 

Unfortunately, neither option you presented really works for my situation.  The data set returned has the possibility of being rather large, possibly thousands of items, so we need pagination.  As for sorting and filtering, the customer is expecting the advanced sorting and filtering possible with the OOB List View filters, and I don't think I can recreate that on my own.  I wish there was a way to get filtering and sorting parameters via a Rule...

 

Oh well, I guess I'll stick with my current solution.  I'm using the Export to Excel component from the Market, and am trying to create an Export to Excel function for my List View.  The component needs an ADO query as input to get the data that then gets put into the Excel file.  I was hoping to figure all this out so I could create an Excel file that was an exact replica of the List View as the customer sees it (minus the pagination).  I actually did make a series of rules that would add a where and order by clause to the ADO query that returned only the items currently visible in the List View and in the same order, but it only works for the current page shown.  My original solution, and the one I'll stick with, is to just pass in the ADO query that gets ALL data, and have the customer do whatever filtering and sorting they want in the Excel file.  It does work, but seems a bit excessive if the customer has their List View filtered down to only one or two items.

 

Thanks again :)

Reply