Forum Discussion

pranjbhatt's avatar
pranjbhatt
New Contributor III
11 months ago
Solved

Send Multiple HTML Tables in Email using XML Parser

Hi, 

I am working to send multiple tables in a single email using XML Parser.
I am using Groupby Field snap to for group respective categories and send out details of each category as a table(in a single mail)

Following is the structure of JSON file.

[{
    "source_system_group": "group1",
    "source_system_details": {"Details_1": value1},{"Details_2": value2}, {Details_3: value_3}
 }
  {
    "source_system_group": "group2",
    "source_system_details": {"Details_1": value1},{"Details_2": value2}, {Details_3: value_3}
  }
{ "source_system_group": "group3", "source_system_details": {"Details_1": value1},{"Details_2": value2}, {Details_3: value_3} } ]

I cannot call and populate individual tables and values. Following is my HTML Code. Review and let me know. 

 

<html>
    <head>
        <style>
            table {
                width: 100%;
                border: 1px solid black; 
            }
            thead th {
                background: black;
                color: white;
                border: 1px solid black
            }
            tbody tr:nth-child(even) {
                background: #D9D9D9;
            }
            td {
                padding: 5px;
                border: 1px solid black;
            }
        </style>
    </head>
    <body>
        <p>Hi, </p>
        <p>Following is the status of data load </p>
        <p></p>
        $foreach (item in $)
        <h2>$item.source_system_group</h2>
        <table>
            <thead>
                <tr>
                <th>SDP_SOURCE_SYSTEM_CODE</th>
                <th>TARGET_TABLE</th>
                <th>LAST_REFRESH_DATE</th>
                </tr>
            </thead>
            <tbody>
                $foreach(details in item.source_system_details)
                <tr>
                    <!--check for load value before selection of the table values-->
                    <td>$details.Details_1</td>
                    <td>$details.Details_2</td>
                    <td>$details.Details_3</td>
                </tr>
                $end
            </tbody>
        </table>
        $end
        <p>Regards,</p>
        <p></p>
    </body>
</html>

 

 

 

 

1 Reply

  • alchemiz's avatar
    alchemiz
    Contributor III

    Hi @vincenr

    Good day, this are extended characters/ascii code which maybe be viewed in excel or other app as special character

    So, what do you want to do with this characters?

    Here are some options that you can do (1) replace the extended characters with the regular ones or (2) just remove all those characters

    $the_text_description.replace(/”|“|‘|’|–|—/g, m=> match m { '”'=> '"', '“'=> '"', "‘"=> "'", "’"=> "'", "—"=> "-", "–"=> "-" })
    
    or you can also totally removed those characters
    
    $the_text_description.replace(/”|“|‘|’|–|—/g, '')
    
    

    Thanks,
    MM

    • vincenr's avatar
      vincenr
      New Contributor III

      OK, I will try that period. Thank but please leave this ticket open until after I verify if it works.

    • vincenr's avatar
      vincenr
      New Contributor III

      I’d rather see the syntax for how to only include a-zA-z0-9.()’

    • vincenr's avatar
      vincenr
      New Contributor III

      How would the syntax work for CRLF? That is, if I only want to replace
      CRLF with a space in a field?