Suggest a method to get it
clone the original datatable to create new datatable and add each row to the new table .use output datatable activity to convert datatable to string and use message box to display it
if i have 10 rows in that table means I want to print each row seperately that why i am using for each but each row shoud have its heading
we are using cloning to get the headers
dtnew=dtold.clone…here dtnew will have all the columns in the original datatable
now inside for loop use add datarow and pass the datarow to dtnew
Hope this helps
Get the headers with:
headers = String.Join(", ", dt.Columns.Cast(Of DataColumn).Select(Function(c) c.ColumnName))
Then assign this text in the message box:
headers + vbCrLf + String.Join(", ", CurrentRow.ItemArray)
Hi @Gopikrishna_S ,
Maybe this is an Alternate Method :
We convert the DataRow to Array of DataRows just by adding to an Array. Then we convert it to Datatable and use it in Output Datatable
Activity.
In the Image above, str_DT
contains the Output of Output Datatable
Activity.
the JSON way:
shall use this expression inside the email activity
Shall I Send this datatable in send email activity
Could you let us know what is your Objective ?
Do you want to Add a Table in Mail Body? This was not mentioned in the Topic.
However, if you do want to add table in Mail Body you would have to Convert the Datatable into Html Table.
You could Check the Below post for Performing this :
Let us know if this satisfies or do explain your actual requirement.
I do think this can be achieved by combining my two posts from above.
For Better Clarity, you could create a Temporary Datatable, say TempDT
.
Now, Inside the For Each Row
Activity, use an Assign
Activity like below :
Next, Converting the TempDT
to HTML Table format. As mentioned from the above post we get the Expression to Convert Datatable to HTML, we can use it like below :
The variable HtmlBodyStr
is of String type, which you can then add to your mail body in your Send Mail Activity.
The Converted Data will appear in the below way, which you can then use as the Mail Body value.
Please do implement this in Send SMTP Mail Message Activity…it show error that string should be double quoted…then if I double quote it means it will just print “HtmlBodyStr” which is a just a string not the expected html output
@Gopikrishna_S , Please do share screenshots of your implementation to analyse the problem further.
Have you Checked IsBodyHtml
Property in the Mail Activity ?
I am Printing two table in a single mail but its merging, what is the solution to print two tables seperately
You might need to Append <br></br>
after each iteration.
HTMLBodyStr = HTMLBodyStr+"<br><br>"
I Have mentioned both table in body of the Mail by giving some space how to avoid it from merging.
@Gopikrishna_S , Instead of space, use the below and Check :
"<br><br>"