lynnsong986
(Lynnsong986)
September 11, 2021, 12:59am
1
Hello I have a snippet that transposes a datatable. I don’t understand this assign here:
assign
dt_Final.Rows(row_Number)(Column_Number) = row((row_Number)).ToString
for example, the initial value of row_number and column_column is 0, what would one interpret
dt_Final.Rows(0)(0)?
dt.Final is a variable, type DataTable
thank you so much in advance.
Hi
Let’s take it one by one
First left side
dt_Final.Rows - this gives ienumerable of datarow which means to be simple array of rows
Now in that we want specific cell value and if that is needed we need to know that row and column position
So when you are trying to mention that row and column position We will be mentioning as index
Index value usually starts from 0 for first row or first column
So
dt_Final.Rows(row number)(column number)
Row number and column number here are index positions
So finally we are assigning a particular row and it’s column value to a specific cell
Let’s take like we are in a FOR EACH ROW loop and datatavle is passed as a input to it
Inside the loop we would have used a assign activity like this
dt_Final.Rows(row_Number)(Column_Number) = row((row_Number)).ToString
So here
dt_Final(0)(0) means first cell in first row and first column
It’s more like Matrix (m x n)
Where m is row and n is column
Cheers @lynnsong986
1 Like
@Palaniyappan thank you so much for your time explaining in such detail, really appreciate it!
Lynn
1 Like
system
(system)
Closed
September 14, 2021, 4:53am
5
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.