Mapping dynamic columns in Paging Grid

I am looking for assistance on mapping one of the DB column to multiple fields in "Paging Grid" - dynamically .
Database records:
{
{col1: "dcgsdf", col2: "thstr", col3: "col31~abc|col32~def|col33~ghi", col4:56},
{col1: "asdg", col2: "jtrj", col3: "col31~xsy|col32~adf|col33~qere", col4:32},
{col1: "fdhd", col2: "dfhs", col3: "col31~qwwe|col32~dasw|col33~afds", col4:3},
{col1: "rae", col2: "DGAS", col3: "col31~qerw|col32~qef|col33~qwer", col4:0}
}


Paging Grid should split col3 by delimiter "|" to identify the new columns col31, col32 and col33, and further by delimeter "~" for column name and value. Something like the below resulting dataset.
{
{col1: "dcgsdf", col2: "thstr", col31: "abc", col32: "def", col33: "ghi", col4:56},
{col1: "asdg", col2: "jtrj", col31: "xsy", col32: "adf", col33: "qere", col4:32},
{col1:...

OriginalPostID-231994

  Discussion posts and replies are publicly visible

  • ... "fdhd", col2: "dfhs", col31: "qwwe", col32: "dass", col33: "afds", col4:3},
    {col1: "rae", col2: "DGAS", col31: "qerw", col32: "qef", col33: "qwer", col4:0}
    }
    ** All the dynamic columns "col31, col32, col33" would be Text type.

    Also the number of columns in col3 can very based on the type of the record. For with I have another table called template with contains the header(name) of the dynamic columns. For example in above case my template will return me: {"col31|col32|col33"}. It could be {"col31|col32|col33|col34"} for some other set of data.


    Any assistance will be helpful.
  • @nimishan I would suggest doing as follows if you are planning to achieve this use case in Appian by making use of expression rules:

    1. Get the required data (which consists of data in col3 from various columns joined by delimiter "|") from the source.
    2. Create an expression rule that processes the data obtained in Step - 1 by splitting and assigning to different columns. You may need to use a formatted CDT which consists of all the possible columns(such as col31, col32) from all the record types that might be obtained from the joined data (in col3 as per your example). Doing so also ensures the sorting of the grid (I would suggest staying away from splitting the data and assigning to columns on the fly by making use of paging grid as this makes you loose the sorting capability and also complicates by mixing the data processing and display logic).
    3. Invoke the gridTextColumn for the dynamic columns(which are joined in col3 by "|" delimiter as per your example) conditionally. You may look at the apply components for this purpose.

    If you choose to implement by making use of expression rules as said above, I would suggest limiting the number of records you show in paging grid as this hampers the performance if you are working on large datasets at a time.

    Are you able to attach the snapshots of database entities(of those based on which you will be building the grid) with some sample data? This helps the practitioners to give a quick idea of what can be done in the database(whether to build a view or stored procedure) so that we can refrain from complicating the implementations from Appian end.
  • Yes Philb, I should have posted the follow up question on the same thread but preferred posting it as separate query for quicker response!

    Now I need to implement this on Paging grid (a!gridField()), due to performance issue. Basically, looking for code to create a!gridTextColumn columns dynamically by splitting the "Col3" content - the way you implemented for a!gridLayout().