Replacement for ncolumntable function

Hi all, I notice that the HTML Display Functions plugin is not listed on the app market and therefore may not be supported in the future, but I'm sure that many of us have it deployed in our environments for one reason: the function ncolumntable().

For anyone looking to remove this plugin, I'm including here an expression rule that I wrote to perform a similar task, and it also has the benefit of having no limit on the number of columns. Given a list of column headers, a list of Dictionaries, Maps, or CDTs containing the data to display, identifiers for fields in the data (optional - if blank, a!keys() will be used to determine the list of identifiers for each row of data), and some optional formatting parameters, this rule returns HTML code to generate a table displaying the data.

This expression rule has the following parameters:

columnHeaders (List of Text)

data (Any Type)

columnKeys (List of Text)

headerColor (Text)

evenRowColor (Text)

oddRowColor (Text)

/* Table parameters */
"<table width='100%' cellspacing='0' cellpadding='4' style='margin:0px;padding:4px;border:1px solid #ebebeb;font-size:12px; font-family:arial'>"

&

/* Header row parameters */
"<tr style='background-color:" & a!defaultValue(value: ri!headerColor, default: "#b2d1e0") & ";font-weight:bold'>"
&
/* Header row cells */
concat(
  a!forEach(
    items: ri!columnHeaders,
    expression: "<td>" & fv!item & "</td>"
  )
)
&
"</tr>"

&

/* Rows of data */
concat(
  a!forEach(
    items: ri!data,
    expression:
      /* Row parameters */
      "<tr style='background-color:" &
      if(mod(fv!index,2) = 0,
        a!defaultValue(value: ri!oddRowColor, default: "#f0f7ff"),
        a!defaultValue(value: ri!evenRowColor, default: "#ffffff")
      )
      & "'>"
      &
      /* Cells in each row */
      concat(
        a!localVariables(
          local!thisRow: fv!item,
          a!forEach(
            items: a!defaultValue(value: ri!columnKeys, default: a!keys(local!thisRow)),
            expression: "<td>" & a!defaultValue(value: tostring(index(local!thisRow,fv!item,null)), default: "") & "</td>"
          )
        )
      )
      &
      "</tr>"
  )
)

&

"</table>"

  Discussion posts and replies are publicly visible