Read the collection rows in email body using blueprism

Amrutha12

New Member
hi all,

I have two collections, both the collection has n no. of rows and i need to send few rows in it over mail with background color.
Background color is the second collection which needs to be added for first collection.
Ex :
One collection with data:
1616665390350.png
Another Collection, have colors to add as background color:
1616665545441.png

i have used the below code to create the table in email body but I am unable to add background color as per the second collection, because i am not able to fetch the row value. Can anybody suggest on this?

Code:
StringBuilder sb = new StringBuilder{};
    sb.Append("<br><br>");
    if (TableInput.Rows.Count > 0){
        if (ColorInput.Rows.Count > 0){
            
            sb.Append("<table style='border:1px solid black; border-collapse: collapse;'>");
    sb.Append("<tr style='border:1px solid black; border-collapse: collapse; padding:2px;'>");
    foreach (DataColumn dc in TableInput.Columns)
    {
       sb.Append("<th style='border:1px solid black; border-collapse: collapse; padding:2px;'>");
       sb.Append(dc.ColumnName);
       sb.Append("</th>");
    }
    sb.Append("</tr>");

    foreach (DataRow dr in TableInput.Rows)
    {
    
       sb.Append("<tr style='border:1px solid black; border-collapse: collapse; padding:2px;background-color:yellow;'>");
       foreach (DataColumn dc in TableInput.Columns)
       {
          sb.Append("<td style='border:1px solid black; border-collapse: collapse; padding:2px;'>");
          sb.Append(dr[dc.ColumnName].ToString());
          sb.Append("</td>");
       }
       sb.Append("</tr>");
    }
    foreach (DataRow label1 in ColorInput.Rows)
    sb.Append(" currentRow(1).ToString();");
    sb.Append("label1.Text");
    sb.Append("</table><br><br>");
            
            }
        }
    
outEmailBody = sb.ToString();

Thanks
 
Top