Question

Can we populate the grid columns dynamically?

I would like to check a possibility of having dynamic grid.
we basically have a requirement to maintain our reference data.
we have 1100 data base tables where we store different kind of reference data. each table structure is different with different number of columns.
We want to introduce a feature where users would be managing the data into these tables from pega.
basically, we have a drop down with all list of table names. Once the table name is selected, we need to display all the rows and columns from the selected table.
If we go with different grids or sections, we will need to create 1100 different sections/grids. and this would be a raw way of doing it.

So, just want to check if there is a way of populating the grid dynamically with the structure of the selected table name.
I know there is a way to configure from report definition but still we need to define the report definition with table structure upfront, which we do not want.

Please let me know if there is a way to address this.

***Edited by Moderator Marissa to update SR Details***

Group Tags

Comments

Keep up to date on this post and subscribe to comments

Pega
October 3, 2018 - 3:05am

Hi,

This is doable if you can get the table metadata(column/type information) at runtime:

1. Create a "template" report definition in @baseclass with a dummy set of column properties referenced there.

2. Configure a section with a grid configured on the above RD. Make sure to mark the "Create Grid Dynamically" option and specify a virtual RD page name. 

3. On selecting a particular table from the dropdown, run a custom activity that would 

- Open the template RD definition onto a clipboard page with the virtual RD page name from 2

- Fetch the table metadata

- Update the virtual RD model on the clipboard with fields. Refer OTB activitiy pzPrepareRecordsEditor

4. Refresh the grid

Do note however, that the approach is a bit involved and requires investigating the RD model for updating it.

July 16, 2019 - 6:32am

Hi,

Kindly share the solution used for this problem. We have a similar requirement.

Thanks

Ramya