Cna some pelase help me on How to print Values in Array variable as string.
As I created an Array varaible and it is storing the values as a list and I wanted to print those values.
string.join(“,”,ArrayVariable)
This will prient all the elements of your array seperated by comma
Regards,
Mahesh
@MAHESH1 I need like one by one list not in same line, how to do that
@MAHESH1 Sorry some thing is missed not getting expcted results. let me tell you,
I have an CSV file and in with 2ncloumn has many and only few row are has data remaining are empty. and I need the non empty cell vaules to store in a Array varaible and I wanted to print the those stored values in a mail body. this is my requirement
@sambana_karunakar
What is the datatype of list you are using
Regards,
Mahesh
list is string
Create a Variable of ListOf Strings List_Names
Use Add to Collections Activity
Add row(“Column-1”).ToString to collections i.e List_Names
At last outside for each
strA=string.Join(Environment.NewLine,List_Names)
Regards,
Mahesh
@sambana_karunakar
If its a string then definitely it will contain only the last value.
Regards,
Mahesh
First get the column value for. The datatable to array.(use linq to get the column value to array)
@MAHESH1 try linq query to get all the value
Then use
string.Join(Environment.NewLine,Array_Variable)
If you use for each Loop each time you will get mail with single value
Regards,
Arivu
@sambana_karunakar
Let us take you are having a datatable dta
No need to use foreach row
List A-List of Strings-Use in Assign Activity
ListA=(From p in dta.Select()
where not string.IsEmpty(Convert.ToString(p.Item(“Column-1”)))
Select Convert.ToString(p.Item(“Column-1”))).ToList()
string a=string.join(Environment.NewLine,ListA)
Regards,
Mahesh
Good work @MAHESH1,
@sambana_karunakar use this code
Small change
string a=string.join(Environment.NewLine,ListA.ToArray())
Pass this string value to mail and send it
Regards,
Arivu
@arivu96
I think even if its list also it will join.
Regards,
Mahesh
Yes correct. I did’t noticed.
Hey I am getting error inthis can you correct it again
(From p in dt.Select()
where not string.IsEmpty(Convert.ToString(p.Item(“Column-1”))
Select Convert.ToString(p.Item(“Column-1”))).ToList()
@sambana_karunakar
Replace dt with your datatable variable
Regards,
Mahesh
dt is my data varaible
@sambana_karunakar
Can you share the screen shot of error
Regards
Mahesh