Table/(Grid with read only data) with coloring in email notification

Can some suggest what is the best way to display a tabular data with coloring on rows in email body via a notification ?

Currently using ncolumntable() for table formation and used default html template in send email smart service for email body.

As the current requirement is to show the data in rows different color based on one of the column data (have some validations ) .I have tried using Ncoulmnstyledtable) , its not working .

Appian version is 16.3.

  Discussion posts and replies are publicly visible

  • But , First row in table is always displaying as empty row and after calculating DaysOfNon-compliant - it was displaying the value appending with semicolon.

    Child rule

    concat(

    if(

    if(

    rule!lengthNullSafe(

      todate(index(index(ri!PRTRR_PipelineList, "DateofNonCompliance", null()), ri!index, null()))

      ) = 0,

    0,

    if(

       todate(index(index(ri!PRTRR_PipelineList, "DateofNonCompliance", null()), ri!index, null())) > todate(now()),

    tointeger(todate(index(index(ri!PRTRR_PipelineList, "DateofNonCompliance", null()), ri!index, null()))-todate(now())),0)

     

    )>97,"<tr bgcolor='yellow'>",if(

    and(if(

    rule!lengthNullSafe(

      todate(index(index(ri!PRTRR_PipelineList, "DateofNonCompliance", null()), ri!index, null()))

      ) = 0,

    0,

    if(

       todate(index(index(ri!PRTRR_PipelineList, "DateofNonCompliance", null()), ri!index, null())) > todate(now()),

    tointeger(todate(index(index(ri!PRTRR_PipelineList, "DateofNonCompliance", null()), ri!index, null()))-todate(now())),0)

     

    )<=97 ,if(

    rule!lengthNullSafe(

      todate(index(index(ri!PRTRR_PipelineList, "DateofNonCompliance", null()), ri!index, null()))

      ) = 0,

    0,

    if(

       todate(index(index(ri!PRTRR_PipelineList, "DateofNonCompliance", null()), ri!index, null())) > todate(now()),

    tointeger(todate(index(index(ri!PRTRR_PipelineList, "DateofNonCompliance", null()), ri!index, null()))-todate(now())),0)

     

    )>0),"<tr bgcolor='orange'>",if(

    if(

    rule!lengthNullSafe(

      todate(index(index(ri!PRTRR_PipelineList, "DateofNonCompliance", null()), ri!index, null()))

      ) = 0,

    0,

    if(

       todate(index(index(ri!PRTRR_PipelineList, "DateofNonCompliance", null()), ri!index, null())) > todate(now()),

    tointeger(todate(index(index(ri!PRTRR_PipelineList, "DateofNonCompliance", null()), ri!index, null()))-todate(now())),0)

     

    )<=0,"<tr bgcolor='red'>",""

    )

    )

    ),

     

      "<td>"&index(index(ri!PRTRR_PipelineList, "LicenseNumber", null()), ri!index, null())&"</td>",

       "<td>"&index(index(ri!PRTRR_PipelineList, "LineNumber", null()), ri!index, null())&"</td>",

      "<td>"&index(index(ri!PRTRR_PipelineList, "LastProducingUWI", null()), ri!index, null())&"</td>",

      "<td>"&index(index(ri!PRTRR_PipelineList, "activity_type", null()), ri!index, null())&"</td>",

      "<td>"&rule!displayDateTimeListSimple(index(index(ri!PRTRR_PipelineList, "LastProdDate", null()), ri!index, null()))&"</td>",

      "<td>"&rule!displayDateTimeListSimple(index(index(ri!PRTRR_PipelineList, "DateofNonCompliance", null()), ri!index, null()))&"</td>",

      "<td>"&if(

    rule!lengthNullSafe(

      todate(index(index(ri!PRTRR_PipelineList, "DateofNonCompliance", null()), ri!index, null()))

      ) = 0,

    0,

    if(

       todate(index(index(ri!PRTRR_PipelineList, "DateofNonCompliance", null()), ri!index, null())) > todate(now()),

    tointeger(todate(index(index(ri!PRTRR_PipelineList, "DateofNonCompliance", null()), ri!index, null()))-todate(now())),0)

     

    )&"</td>",

      "</tr>"

    )

     

    passing the index as (_) from parent rule.

  • Hmm.But the first row in table is always displaying as empty row and daysofnon-compliant is displaying the value appending with ;.

     

    child rule as shown below. index  value passed as _ from parent rule.

    concat(

    if(

    if(

    rule!lengthNullSafe(

      todate(index(index(ri!PRTRR_PipelineList, "DateofNonCompliance", null()), ri!index, null()))

      ) = 0,

    0,

    if(

       todate(index(index(ri!PRTRR_PipelineList, "DateofNonCompliance", null()), ri!index, null())) > todate(now()),

    tointeger(todate(index(index(ri!PRTRR_PipelineList, "DateofNonCompliance", null()), ri!index, null()))-todate(now())),0)

     

    )>97,"<tr bgcolor='yellow'>",if(

    and(if(

    rule!lengthNullSafe(

      todate(index(index(ri!PRTRR_PipelineList, "DateofNonCompliance", null()), ri!index, null()))

      ) = 0,

    0,

    if(

       todate(index(index(ri!PRTRR_PipelineList, "DateofNonCompliance", null()), ri!index, null())) > todate(now()),

    tointeger(todate(index(index(ri!PRTRR_PipelineList, "DateofNonCompliance", null()), ri!index, null()))-todate(now())),0)

     

    )<=97 ,if(

    rule!lengthNullSafe(

      todate(index(index(ri!PRTRR_PipelineList, "DateofNonCompliance", null()), ri!index, null()))

      ) = 0,

    0,

    if(

       todate(index(index(ri!PRTRR_PipelineList, "DateofNonCompliance", null()), ri!index, null())) > todate(now()),

    tointeger(todate(index(index(ri!PRTRR_PipelineList, "DateofNonCompliance", null()), ri!index, null()))-todate(now())),0)

     

    )>0),"<tr bgcolor='orange'>",if(

    if(

    rule!lengthNullSafe(

      todate(index(index(ri!PRTRR_PipelineList, "DateofNonCompliance", null()), ri!index, null()))

      ) = 0,

    0,

    if(

       todate(index(index(ri!PRTRR_PipelineList, "DateofNonCompliance", null()), ri!index, null())) > todate(now()),

    tointeger(todate(index(index(ri!PRTRR_PipelineList, "DateofNonCompliance", null()), ri!index, null()))-todate(now())),0)

     

    )<=0,"<tr bgcolor='red'>",""

    )

    )

    ),

     

      "<td>"&index(index(ri!PRTRR_PipelineList, "LicenseNumber", null()), ri!index, null())&"</td>",

       "<td>"&index(index(ri!PRTRR_PipelineList, "LineNumber", null()), ri!index, null())&"</td>",

      "<td>"&index(index(ri!PRTRR_PipelineList, "LastProducingUWI", null()), ri!index, null())&"</td>",

      "<td>"&index(index(ri!PRTRR_PipelineList, "activity_type", null()), ri!index, null())&"</td>",

      "<td>"&rule!displayDateTimeListSimple(index(index(ri!PRTRR_PipelineList, "LastProdDate", null()), ri!index, null()))&"</td>",

      "<td>"&rule!displayDateTimeListSimple(index(index(ri!PRTRR_PipelineList, "DateofNonCompliance", null()), ri!index, null()))&"</td>",

      "<td>"&if(

    rule!lengthNullSafe(

      todate(index(index(ri!PRTRR_PipelineList, "DateofNonCompliance", null()), ri!index, null()))

      ) = 0,

    0,

    if(

       todate(index(index(ri!PRTRR_PipelineList, "DateofNonCompliance", null()), ri!index, null())) > todate(now()),

    tointeger(todate(index(index(ri!PRTRR_PipelineList, "DateofNonCompliance", null()), ri!index, null()))-todate(now())),0)

     

    )&"</td>",

      "</tr>"

    )

     

     

  • But the first ron in table is always coming as empty row and value of dayofnon-compliant is appending with semicolon in all rows
    concat(
    if(
    if(
    rule!lengthNullSafe(
    todate(index(index(ri!PRTRR_PipelineList, "DateofNonCompliance", null()), ri!index, null()))
    ) = 0,
    0,
    if(
    todate(index(index(ri!PRTRR_PipelineList, "DateofNonCompliance", null()), ri!index, null())) > todate(now()),
    tointeger(todate(index(index(ri!PRTRR_PipelineList, "DateofNonCompliance", null()), ri!index, null()))-todate(now())),0)

    )>97,"<tr bgcolor='yellow'>",if(
    and(if(
    rule!lengthNullSafe(
    todate(index(index(ri!PRTRR_PipelineList, "DateofNonCompliance", null()), ri!index, null()))
    ) = 0,
    0,
    if(
    todate(index(index(ri!PRTRR_PipelineList, "DateofNonCompliance", null()), ri!index, null())) > todate(now()),
    tointeger(todate(index(index(ri!PRTRR_PipelineList, "DateofNonCompliance", null()), ri!index, null()))-todate(now())),0)

    )<=97 ,if(
    rule!lengthNullSafe(
    todate(index(index(ri!PRTRR_PipelineList, "DateofNonCompliance", null()), ri!index, null()))
    ) = 0,
    0,
    if(
    todate(index(index(ri!PRTRR_PipelineList, "DateofNonCompliance", null()), ri!index, null())) > todate(now()),
    tointeger(todate(index(index(ri!PRTRR_PipelineList, "DateofNonCompliance", null()), ri!index, null()))-todate(now())),0)

    )>0),"<tr bgcolor='orange'>",if(
    if(
    rule!lengthNullSafe(
    todate(index(index(ri!PRTRR_PipelineList, "DateofNonCompliance", null()), ri!index, null()))
    ) = 0,
    0,
    if(
    todate(index(index(ri!PRTRR_PipelineList, "DateofNonCompliance", null()), ri!index, null())) > todate(now()),
    tointeger(todate(index(index(ri!PRTRR_PipelineList, "DateofNonCompliance", null()), ri!index, null()))-todate(now())),0)

    )<=0,"<tr bgcolor='red'>",""
    )
    )
    ),

    "<td>"&index(index(ri!PRTRR_PipelineList, "LicenseNumber", null()), ri!index, null())&"</td>",
    "<td>"&index(index(ri!PRTRR_PipelineList, "LineNumber", null()), ri!index, null())&"</td>",
    "<td>"&index(index(ri!PRTRR_PipelineList, "LastProducingUWI", null()), ri!index, null())&"</td>",
    "<td>"&index(index(ri!PRTRR_PipelineList, "activity_type", null()), ri!index, null())&"</td>",
    "<td>"&rule!displayDateTimeListSimple(index(index(ri!PRTRR_PipelineList, "LastProdDate", null()), ri!index, null()))&"</td>",
    "<td>"&rule!displayDateTimeListSimple(index(index(ri!PRTRR_PipelineList, "DateofNonCompliance", null()), ri!index, null()))&"</td>",
    "<td>"&if(
    rule!lengthNullSafe(
    todate(index(index(ri!PRTRR_PipelineList, "DateofNonCompliance", null()), ri!index, null()))
    ) = 0,
    0,
    if(
    todate(index(index(ri!PRTRR_PipelineList, "DateofNonCompliance", null()), ri!index, null())) > todate(now()),
    tointeger(todate(index(index(ri!PRTRR_PipelineList, "DateofNonCompliance", null()), ri!index, null()))-todate(now())),0)

    )&"</td>",
    "</tr>"
    )
  • But the first row in table is always displaying as empty row and value of dayOfnon-compliant is appending with semicolon at the end for all rows (i.e. daysofnon-compliant is calculate based on dateofnon-compliant).
  • 0
    Certified Lead Developer
    in reply to Soujanya B

    You can use String concatenation instead of using concat() function in Child rule like &" "& , to avoid semi-colon issue, if this do not work, try removing semicolon from the resultant String using text Function

  • Thanks! Finally completed my requirement with your help.
    Thanks for the quick replies.
  • 0
    Certified Lead Developer
    in reply to Soujanya B
    You are welcome, glad to hear that it worked.
  • Hi ,
    I have a requirement to display legend tags with color boxes outlined with black border.
    I am able to display successfully in browser , but the same is not visible in email notification.
    "This message was sent by the Appian - PRTRR (Request to Retain or Retire) process.<br/><br/>" &
    if(rule!APN_isBlank(ri!group_txt),
    if(
    rule!APN_isBlank(ri!district_txt),
    "AMU: " & ri!AMU_txt,
    "District: " & ri!district_txt
    ),
    "Group: " & ri!group_txt
    )
    & "<br/><br/>" & if(
    rule!APN_isEmpty(
    ri!PRTRR_PipelineList
    ),
    {},
    "<br/><br/>Please review the following list of pipelines requiring attention. A decision must be made on each pipeline outlined in the table below.<br/><br/>"
    &regexreplaceall("<tr bgcolor='red'><td></td><td></td><td></td><td></td><td></td><td></td><td>0</td></tr>",regexreplaceall(";",rule!PRTRR_createEmailSectionRequireAttention(PRTRR_PipelineList: ri!PRTRR_PipelineList),""),"")
    &"<style>.foo {float: left;width: 20px;height: 20px;margin: 5px;border: 1px solid black;}.red {background: 'red';}.orange {background: 'orange';}.yellow {background: 'yellow';}</style>"
    &"<div class='foo red'></div><font>Non-Compliant Pipelines</font></br></br>"&
    "<div class='foo orange'></div><font>Non-Compliance Imminent</font></br></br>"&
    "<div class='foo yellow'></div><font>Inactive Lines Requiring a Decision</font>"
    )

    not sure about the issue..
    And I am able to execute it with proper color while executing rule.
  • 0
    A Score Level 2
    in reply to aloks0189

    Hey Alok i followed the same thing but when i pass data i am getting some thing like this

  • 0
    Certified Lead Developer
    in reply to rohann179

    Hi Rohan, as I can see, you are trying to perform string concatenation and also you are using if else conditions along with string concatenation, which might be causing you this issue where your conditional statements are also getting printed on the web page.

    Also I believe, you might be missing the double quotes and html tag closure in order, which might be also one of the root cause.

    I strongly suggest, use concat() instead of using &""& for string concatenation, this improves the readability and you can trace out root cause easily.

    Hope it will help you