Column Header Removal from Datatable

image

I am using the following code to print this output,

filtered_dt.DefaultView.ToTable(True,“sap_code”)

image
DT from where I am brining the current output

Expected Output:
image

is it possible to get only the values except the column header or any way to cut off the column header?

Hi,

Which data type do you need as result?
If string type, the following will work.

strResult = String.Join(vbCrLf,dt.AsEnumerable.Select(Function(r) r("sap_code").ToString).Distinct)

Regards,

1 Like

a datatable will allways define a datacolumn along with its column name

depending on your outputting needs we can check for options on how to surpress it. Maybe you can elaborate more on this.

also have a look at this code statement.

strData =

String.Join(Environment.NewLine, filtered_dt.DefaultView.ToTable(True,“sap_code”).Select(Function (x) x(0)))
1 Like

it worked, thank you @Yoichi

1 Like

image
I want to input each of the value separately in a typeinto activity

rn, if I am inputting through the strresult all of the values are passing altogether, I am already insdie a for each DT loop with another DT

how may I input one after another and after inputting one value to typeinto I will input other data too, after completing all of the inputs I will go for second data then third…

Can you help me out once more? @Yoichi

HI,

If it’s necessary to input them separately, it might be better to use not single string but array of string.

arrStr = dt.AsEnumerable.Select(Function(r) r("sap_code").ToString).Distinct

Then use type into with dynamic selector in ForEach

Regards,

1 Like

If you’re trying to input each value separately into a Type Into, then you don’t do all this Join stuff.

You just For Each Row in Datatable and then within that you have your Type Into with CurrentRow(“sap_code”).ToString as the text to type.

@postwick in my CurrentRow the sap_code is not available, this is why I am facing issue to develop my usecase

image
facing this error while trying the assign activity

variable type I am using is, Array of String

Sorry, i had mistake. Expression in the above image is correct.Can you try to add .ToArray at the end of the expression.

arrStr = dt.AsEnumerable.Select(Function(r) r("sap_code").ToString).Distinct.ToArray

Regards,

1 Like

You literally show it in your output.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.