Instant Estimate +44(0)1908738254
YOUR EXPERT RPA PARTNER

Team up with our RPA strategy and tech specialists for maximum automation impact

Find out more
Harness the power of UiPath in your business.
WATCH NOW

Save money and spend more time on priority work.

Book consultation
READY, SET, AUTOMATE

Let's choose, design and deploy a process automation solution for your business.

Find out more
TRANSFORM YOUR BUSINESS

Let's analyse your business to discover opportunities for innovation and automation.

Find out more

Begin your business transformation journey

Book consultation
AUTOMATE EVERY FUNCTION

Automate where it matters most. Scale to solve challenges in every area

Find out more
GIVE EVERY TEAM THE TOOLS FOR SUCCESS

Equip people with user-friendly solutions that save time and make work easier

Find out more

Which business problem
can we solve first?

Book consultation
19 June 2017

Export Dynamic or User Defined Filtered Data From a K2 List View to EXCEL

K2 List View allows users to define custom filters to filter list data based on a user’s required filter criteria. The List View filter feature in K2 is called the User Filter and it is very useful as it provides the user the flexibility to choose their own filter criteria for list data. This is especially useful to create tabular-style reports in K2 where there is a requirement to filter the report by multiple criteria. The issue is that you sometimes want to do something in bulk with the filtered data.

K2 Automated Testing Software

rnBenchQA allows full test automation of K2, including fully automated K2 SmartForms and K2 Workflow testing. It promotes test driven development for K2 and ensures continued quality assurance for K2 solutions. Easily apply changes to test cases to accommodate changes to K2 apps and ensure all apps are regression tested to avoid defects and assure continuous quality.

 

Free K2 Five Upgrade Review

 

This blog will show you how to perform operations on filtered data – for example exporting it to Excel. Other operations like bulk update or deletion can also be performed, but we focus on the Excel export.

Registration is required to view the full article. Click here to register FREE…

We will use simple jQuery in the K2 SmartForm to select all the list items that are filtered by the User Filter (or quick search) with the intention to perform an action on the items using the K2 For-Each SmartForms loop on the “Selected” items.

Let’s look at an example

Consider the example order data below that is filtered based on a User Filter “Unit Price” and that is further refined by a quick text search. The latter makes this feature extremely useful, as it does not just rely on the User Filter.


[ihc-hide-content ihc_mb_type=”show” ihc_mb_who=”1,2,3,5″ ihc_mb_template=”1″]
To select the list items, which are a result of a filter or quick search, use the following jQuery script:

<script type=’text/javascript’>$(“tr”).addClass(‘selected’);</script>

Transfer this script into a K2 datalabel which is marked as a literal to enable it to execute at runtime.

Now, perform any action on the selected items using the following “For- Each” condition; setting “Selected” on the condition selection.

Once the action is completed use the following JQuery script to deselect the list items:

<script type=’text/javascript’>$(“tr”).removeClass(‘selected’);</script>

This jQuery trick was used for Excel export and will only export the filtered list items. The clever bit is the ID fields of the “Selected” items are transferred into a data label and used as a filter in the Excel control, hence only exporting the filtered data!

Following is the Excel file export which contains data that are filtered based on the user filters –

Summary

This a useful feature to create a dynamic Excel export based on a user filter or data returned in a K2 List View based on a quick filter. We use this quite extensively in our solutions, as business users love to export data to Excel based on K2 filters to analyse it further.

Need further technical advice or support?