ncolumntable or HTML table

Hi,

which is the best practice in terms of creating a table?

Is it ncolumntable or html table?

 

Thanks and Regards

Rohini

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Lead Developer

    Hi Rohini

    As per my understanding, if you are looking to generate a dynamic table in Appian then i would prefer to go for Custom Implementation of HTML Table data generation.

    Considering the following table structure:

    <!DOCTYPE html>
    <html>
    <head>
    </head>
    <body>
    
    <table border="1">
      <tr>
        <th>Month</th>
        <th>Savings</th>
      </tr>
      <tr>
        <td>January</td>
        <td>$100</td>
      </tr>
      <tr>
        <td>February</td>
        <td>$80</td>
      </tr>
      <tr>
        <td>March</td>
        <td>$50</td>
      </tr>
    </table>
    
    </body>
    </html>

    We can create a HTML template which will be as follows: 

    <!DOCTYPE html>
    <html>
    <head>
    </head>
    <body>
    
    <table border="1">
      <tr>
        <th>Month</th>
        <th>Savings</th>
      </tr>
      ###data###
    </table>
    
    </body>
    </html>
    

     

    Now we can generate the data for this table dynamically as follows:

    1. Create an expression rule, let's say YourProject_generateTableContent which will have an input of type CDT, for which we want to generate the Table form data as shown below:

    a!forEach(
      ri!input_cdt,
      concat(
        "<tr>",
        "<td>"&index(fv!item, "month", null())&"</td>",
        "<td>"&dollar(index(fv!item, "amount", null()))&"</td>",
      "</tr>"
      )
    )
    /*
    Considering input_cdt is your Rule input of type CDT or Any Type 
    which has two fields, i.e. month and amount
    */

     

    Now you can make the use of this template wherever you need it. e.g. I want to send an email

    a. Use Send E-Mail Smart Service and choose, use a Text or HTML Template option >> Select your HTML Template >> This will populate data field to replace with a value >> Call your expression rule YourProject_generateTableContent(input_cdt: pv!input_cdt) by passing the input parameter value, setup other properties of this smart service >> Save and Publish and Execute this process.

     

    You can find an email will be triggered where the table data is generated dynamically in Appian(considering the process variable has the value to generate the table cell rows) using it's expression rule.

     

    As per my understanding it's a one time effort but once it's built, can be used for any cdt by defining the input of type AnyType and tweaking this rule a bit and also performance wise this is great as the rule takes very less time to generate the table cell rows/content.

     

    Hope this will help you.

Reply
  • 0
    Certified Lead Developer

    Hi Rohini

    As per my understanding, if you are looking to generate a dynamic table in Appian then i would prefer to go for Custom Implementation of HTML Table data generation.

    Considering the following table structure:

    <!DOCTYPE html>
    <html>
    <head>
    </head>
    <body>
    
    <table border="1">
      <tr>
        <th>Month</th>
        <th>Savings</th>
      </tr>
      <tr>
        <td>January</td>
        <td>$100</td>
      </tr>
      <tr>
        <td>February</td>
        <td>$80</td>
      </tr>
      <tr>
        <td>March</td>
        <td>$50</td>
      </tr>
    </table>
    
    </body>
    </html>

    We can create a HTML template which will be as follows: 

    <!DOCTYPE html>
    <html>
    <head>
    </head>
    <body>
    
    <table border="1">
      <tr>
        <th>Month</th>
        <th>Savings</th>
      </tr>
      ###data###
    </table>
    
    </body>
    </html>
    

     

    Now we can generate the data for this table dynamically as follows:

    1. Create an expression rule, let's say YourProject_generateTableContent which will have an input of type CDT, for which we want to generate the Table form data as shown below:

    a!forEach(
      ri!input_cdt,
      concat(
        "<tr>",
        "<td>"&index(fv!item, "month", null())&"</td>",
        "<td>"&dollar(index(fv!item, "amount", null()))&"</td>",
      "</tr>"
      )
    )
    /*
    Considering input_cdt is your Rule input of type CDT or Any Type 
    which has two fields, i.e. month and amount
    */

     

    Now you can make the use of this template wherever you need it. e.g. I want to send an email

    a. Use Send E-Mail Smart Service and choose, use a Text or HTML Template option >> Select your HTML Template >> This will populate data field to replace with a value >> Call your expression rule YourProject_generateTableContent(input_cdt: pv!input_cdt) by passing the input parameter value, setup other properties of this smart service >> Save and Publish and Execute this process.

     

    You can find an email will be triggered where the table data is generated dynamically in Appian(considering the process variable has the value to generate the table cell rows) using it's expression rule.

     

    As per my understanding it's a one time effort but once it's built, can be used for any cdt by defining the input of type AnyType and tweaking this rule a bit and also performance wise this is great as the rule takes very less time to generate the table cell rows/content.

     

    Hope this will help you.

Children