How to retrieve all column values based on their title?

excel
uiautomation
activities
studio

#1

Hello ,
Guys i just want to retrieve values of a column, based on the condition if the title matches.


ex: if(title = Name){ select both cris and leo}.
Please ping if you have solution

Thank you


#2

@Akhil

  1. Use Read range to read entire data from excel. Mark Add Header property in the read range activity.
  2. Filter Datatable to retrieve only the column values for the specified column
    dtOutput = dtInput.DefaultView.ToTable(true, “ColumnName”)
    dtOutput - Resultant datatable containing only specified column values
    stInput - Data table with data from excel read range
    ColumnName - name of the column to be retrieved
    true - Specifies to eliminate duplicate values in the column. Specifying it to false will include duplicate values as well into the output data table

#3

Thanks @Madhavi for the response.
And I’m just a rookie so not that familiar to it, Can you please say how to filter data-table ? I could only find “filter-table” activity and a option “use-filter” in read range activity. Can you please be specific in simple terms!


#4

@Akhil
Please find attached xaml- RetrieveColumnByTitle.xaml (8.6 KB)


#5

Exactly what i need . Thank you so much @Madhavi :blush:


#6

can u please tell me from where we can learn those type of queries?? @Madhavi


#7

@Akhil
I refered C# and linq for these solutions.


#8

Hai @Madhavi ,
I encountered an issue that while retrieving column values , if it has same consecutive value it will consider only 1 value and i don’t want that to happen. Do you know how to stop that?


#9

Hi, looking at @Madhavi’s solution, he is returning only one column but he used “true” to only take distinct values. I think you can change that to “false” and it will keep the duplicates, if I remember right.

dtInputData.DefaultView.ToTable(false, strColumnName)

#10

As @ClaytonM mentioned, marking flag in ToTable to false will retain all the records.
Marking the flag to True will eliminate the duplicate records.