Get Info from DataTable

Hello,

Im trying to get Data from a Sharepoint list. The data is now stored in the variable “myListItems” with the data type DataTable. I want to retrieve the information for the column called “ProjectNr”. How do i get this information?

Hi @Charly-Moreno

Use Output Datatable from Text activity to convert the datatable variable into string variable and print the string variable in Message Box.

Hope it helps!!

Hey @Charly-Moreno
try this:
myListItems.Rows(0)("ProjectNr").ToString
If you want all values from this column try this:
String.Join(Environment.NewLine, myListItems.AsEnumerable().Select(Function(r) r("ProjectNr").ToString()))

1 Like

Hi @Charly-Moreno

You can retrieve the first row’s “ProjectNr” value using belo:

projectNrValue = myListItems.Rows(0)(“ProjectNr”).ToString()

Use message box - projectNrValue

OR

For retrieve all “ProjectNr” values, use this code:

projectNrList = (From row In myListItems.AsEnumerable()
Select row.Field(Of String)(“ProjectNr”)).ToList()

Use message box use below:
String.Join(", ", projectNrList)

Happy Automation

@Charly-Moreno

Datatable can be access using variablename.Rows(0)(“ColumnName”).ToString this will give first row and the given column names value..change 0 to any number based on which row you need and column name based on which column you need

cheers

Thank you @Anil_G @pikorpa @Parvathy @prashant1603765 for your help,

This has worked for me !

Now I would like to put this data into a SAP Table. I think it has to look something like the following Screenshot. Someone know what I have to write into the “Set to Clipboard” Activity so that all the information from the column “ProjectNr” can be transmitted?

@Charly-Moreno
Whatever variable you used in the previous operation, just pass that variable name, such as projectNrValue.

Or for list you can use like below,

thank you it worked :slight_smile:

1 Like

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