How to write as list


#1

I want to write out my data as a list. My value is ex: "hi max, these are the values that had an error: + var_arg_stuff + please revise. The out put I get is written “hi jon, these are the are the values that had an error: water, soda, juice please revise!”

How do I write it out so my output looks like this: Hi jon these are the values that had an error: water
soda
juice


#2

Hi.

So it depends on if your data is as an Array or in a Table.

In any case, you would need it in an Array or List type. Once it’s an Array or List, you can use String.Join() to output your list

For example, let’s say you have an array that = {“water”,“soda”,juice"}
You would output this like below:

"Hi jon these are the values that had an error:"+System.Environment.Newline+String.Join(System.Environment.Newline, arrayvariable)

Which will return an output like:
Hi jon these are the values that had an error:
water
soda
juice

You can change System.Environment.Newline to a different character also.
For example,

"Hi jon these are the values that had an error: "+String.Join(", ", arrayvariable)

which would return an output like:
Hi jon these are the values that had an error: water, soda, juice

If these items are in a table, then to convert them to a list of some sort, you could do this with vb.net like so:

dt1.AsEnumerable.Select(Funct8ion(r) r(0).ToString.Trim).ToArray

Then, use that as your array of items.

I hope this is helpful.

Regards.


#3

It didn’t work I used the first method but it just makes a new line


#4

Hi.

Verify that your variable has values in it. You can output this in a message box:
variable.count.tostring
or
String.Join(", ",variable)

If that doesn’t help identify the issue, can you post your workflow in more detail like screenshots etc? That way, someone can possible see the issue.

Thanks.