Hi,
I want to take half of columns in an excel sheet which have 10 columns.
I’m using the method dt.defaultView. There is a column name;
“MY
COLUMN
NAME”
I tried Assign like;
dt_1.DefaultView.ToTable(False,“COL1”, “MY” + System.Environment.NewLine + “COLUMN” + System.Environment.NewLine + “NAME”, “COL2”, “COL3”, “COL4”, “COL5”)
But it says there is no column name
“MY
COLUMN
NAME”
How can i take that segmented column with DefaultView?
Any help appreciated.
1 Like
Fine
Let’s do one thing
Use a assign activity like this
str_colName = Datatable.Columns(columnindex).ColumnName.ToString
Where mention the column index of that column to get the exact column name
Usually column index starts from 0 for the first column
Then use DefaultView method like this
dt_1.DefaultView.ToTable(False,“COL1”, str_colName , “COL2”, “COL3”, “COL4”, “COL5”)
Cheers @ercanebiler
3 Likes
Yeah I tried that it works. But lets think a case;
Indexes can change. That’s why i want to move on with column names. Do you suggest anything?
2 Likes
ercanebiler:
Indexes can change.
May I know why it changes
Actually for a solid process the datatable structure should not or won’t change buddy
@ercanebiler
Sometimes we can’t develope the dream work Our robots mostly depends to humans. We are saying you can’t change anything, they know that but they change it Can’t trust humans.
2 Likes
system
(system)
Closed
January 26, 2020, 10:06am
7
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.