Looping through pxResults and set the property to table column title and Value to rows of a table

Can someone tell me how can I achieve the below?

I have a requirement to loop through the pxResults, and populate a table with the values. The property name should be the header of the columns of a table and the corresponding values as rows of the table. Also, based on the class, the properties on pxResults will differ and therefore the table structure. So the table has to be dynamically created.

Example- if I have .pxResults(1) =

Property

Value

pyName

Bar

pyValue

BAR

and pxResults(2) =

Property

Value

pyName

Fieldset

pyValue

OUTLINE

Then the table should be dynamically be built like

pyName pyValue
Bar BAR
Fieldset OUTLINE

@Anandi6488

It should be working. Are you using a Connect-SQL? What platform version is it?

@MarcLasserre_GCS Yes, I am using a select query, and I have my results in a pagelist.pxResults.

How to acheive it? I would like to create the table dynamically. I dont have fixed columns and column headers, based on the query the column headers would differ. The above is just an example.

@Anandi6488

If I understood what you need, then I don’t know how to do it using only a normal table in a normal section.

My approach is to create an HTML section using JSP to create the

.

First, you will need a list of the columns you need in the table. You can get it using a java step.

Second, you will need the HTML section using JSP.

Watch the video I’ve made. Tell me if this is what you need.

@dfrankmv Really appreciate the response, I will try this out!