Krzysztof
(Krzysztof)
October 7, 2019, 8:45pm
1
Hi,
I assign name of columns in my data table to string. I use:
strColumn = dtDataTable.Columns(intCounter+1).ToString
I my data table I have:
row1 - column name
row2 - description of column
A would like to assign date from row2 (as description). How to edit my primary assign: strColumn = dtDataTable.Columns(intCounter+1).ToString
Any ideas?
bcorrea
(Bruno Correa)
October 7, 2019, 8:58pm
2
If you want the name of the columns then use: strColumn = dtDataTable.Columns(intCounter+1).ColumnName
Krzysztof
(Krzysztof)
October 7, 2019, 8:59pm
3
Ok, but I still get name from row1, not row2. It is problem.
Krzysztof
(Krzysztof)
October 7, 2019, 9:04pm
4
Generally we get the same result if we use
strColumn = dtDataTable.Columns(intCounter+1).ColumnName
or
strColumn = dtDataTable.Columns(intCounter+1).ToString
bcorrea
(Bruno Correa)
October 7, 2019, 9:04pm
5
Yes, column names will be always the same inside the same datatable, they are not per row If you want the values of columns (and not the name), then you have to get like this: strColumn = dtDataTable.Rows(intCounter+1).ToString
Krzysztof
(Krzysztof)
October 8, 2019, 5:23am
6
Please see example in xls, what I would to get.
data table description.xlsx (16.4 KB)
Krzysztof
(Krzysztof)
October 8, 2019, 5:23am
7
Please see example in xls, what I would to get.
data table description.xlsx (16.4 KB)
J0ska
October 8, 2019, 7:18am
8
Datatable column has no property like “Description of column”
It only has column name and data (in rows) - like you can see in BuildDataTable activity
I suspect you are mixing up data in datatable rows with properties of datatable object (e.g. name of column)
Cheers
Krzysztof
(Krzysztof)
October 8, 2019, 7:39am
9
Ok. Then is it possible to delate first “row” as name of columns, to receive description of columns?
Eg.
from
NameColumn1 NameColumn2 NameColumn3
DescriptionColumn1 DescriptionColumn2 DescriptionColumn3
receive only
DescriptionColumn1 DescriptionColumn2 DescriptionColumn3
?
Luis261980
(Luis Nunes)
October 8, 2019, 8:08am
10
Sry, but if you use a DT, the names of the Columns will not change only the rows will change.
Why not assing
strColumn = “Column1”
And if your row is 0 you now its collumn 1
You can assing strColumn+row(0).toString or else
Why complicate when you can make it simple…
1 Like
system
(system)
Closed
October 11, 2019, 9:29am
12
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.