Dynamic CDT

Hi All,
Is there any way to create the fields dynamically in cdt and then assign values.

I have a use case,
User will be uploading a excel and i need to show the excel data in grid format (excel can be different),So for that i am using readexceldata function and and I am trying to create a cdt with the column names and their respective row values (here column names are dynamic) to use that in the data field for grid field.

Ex:excel file has 2 columns A,B now the cdt will be an array of row data like {{A:first row A value,B:first row B value},{A:seconf row A value,B:second row B value}} and if the excel has 3 columsn as A,B,C then the expected cdt should be {{A:first row A value,B:first row B value,C:first row C value},{A:seconf row A value,B:second row B value,C:second row C value}} and use this cdt in gridfield data parameter.

Thanks in Advance,
SSP

  Discussion posts and replies are publicly visible

Parents Reply
  • 0
    Certified Lead Developer
    in reply to iswaryan3520

    Sure. foreach() creates one item for each input item. This means that you will get ONE new map for each item in your local!excelData. It will NOT append fields to the same map.

    Appian uses a functional approach for expressions that includes immutability of variables.

    I do my Excel imports in a different way. First I import the file to a staging table with the fields named like in Excel (A, B, C, ...) and the data types are just varchars, then I run a stored procedure that does the necessary data transformation into the final table.

Children