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
15 May 2017

How to create a simple read-only dynamic HTML table in a K2 SmartForm

K2 ListViews are flexible and extremely feature rich, though in some instances, a simple read-only HTML table populated with database records will do. In this article we will show how to create a simple read-only HTML table populated by data in a SQL database.

K2 Automated Testing Software

BenchQA 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 approach is useful when you have a specific requirement to display a basic read-only table in a K2 view alongside other K2 controls. One option is to use one of the K2 List controls, but the customisation of these are limited unless you are prepared to inject CSS into the page.

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

A basic table can be accomplished easily by using only a K2 DataLabel control and a bit of dynamic HTML.

Firstly, you need a K2 View. All you need on the K2 View is a DataLabel control with its ‘Literal’ property checked.

Next, you need to construct the dynamic HTML. In this example, we will construct an HTML table to display data from the ‘User’ table.

You can include internal CSS to set borders, padding, width and whichever other styles you need. The internal CSS can be seen on the screenshot below within the green border. Be sure to use an ID for your table otherwise the CSS will be applied to all matching elements on the page – even the K2 controls.

To embed the HTML into your K2 View you need to execute the SQL Stored Procedure. The SQL Stored Procedure can be set as a method on a K2 SmartObject – for this example it will have a single output parameter namely the dynamic HTML.

On the method’s output mappings simply map the dynamic HTML return value to your K2 DataLabel.

Now you can run your form and your custom table will instantly be displayed in the place of your K2 DataLabel.

Need further technical advice or support?