How to get the values of specific row and store it in variable

I get the final data table to store in excel file. What if i want to store only specific row into variables? Thank you

this is the example of the data table, i want to get the value of website row

Hi @newuser1

dt - your datatable

Create a Variable dtRow of system.data.datarow

In assign,

dtRow = dt.rows(0)

Will give first row, change the index according to your need.

Thanks

so, if i want to get the value from row website, the command will be dtRow = dt.rows(1) ?

maybe row and column is mixed up
in your case getting the Goolge URl

strUrl = YourDataTableVar.Rows(0)(“Website”).toString

@newuser1 you want to store the column into a variable?

If yes please try below steps,

Method 1 (store in datacolumn variable)

  1. Create a variable dtCol of system.data.datacolumn

  2. In assign,

dtCol = dt.columns(“Website”)

Method 2 (store a column in string)

  1. Create a variable strText of type system.string

  2. In assign give

strText = String.join(",",dt.asenunerable.select(function(row) row("Website").tostring).toarray)

Thanks

into string of array

@newuser1 please try this

dt.asenunerable.select(function(row) row("Website").tostring).toarray

Thanks

@newuser1
We do not know your case, but maybe a Dictionary is a better choice:

Assign Activity
Left: dictSEPara | datatype: Dictionary(Of String, String)
Right

new Dictionary(Of String, String) From {
{"Google","www.google.com"},
{"Bing","www.bing.com"}
}

then you can get the bing url by: dictSEPara(“Bing”)

You can also add, edit the value and remove other Search engines afterwards

strText in string, right?

@newuser1
getting from dictionary all urls we do use : dictSEPara.Values

Also have a look here:
grafik

For this Yes it is string, it will give an string array.

strText = dt.asenunerable.select(function(row) row("Website").tostring).toarray

For this it is system.string, it will give a string.

strText = String.join(",",dt.asenunerable.select(function(row) row("Website").tostring).toarray)

Thanks

strText = dt.AsEnumerable.Select(Function(row) row("Website").ToString).ToArray

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