Retrieve one row in a table from another table and get values from searched table


#1

Hello,
This function is very useful when wanting to get a specific row from one table using a row from another table. My issue is all this function does is return true. How can I get the column values of that row as well.

DATATABLE.Select(“COLUMN_NAME=’"+row(0).ToString+"’”)


#2

Hi @bbimuyi,

The above query result will be datarow[]
Use for each activity to get the values. Set

Else if you want the first row record information alone means

Convert.ToString(DATATABLE.Select(“COLUMN_NAME=’"+row(0).ToString+"’”)(0)("columnname"))

Regards,
Arivu


#3

My apologies, I meant to copy in this function. It returns a Boolean.

DT.AsEnumerable().Any(Function(x) x(“DT_Column”).ToString = “Argument”)

If I use this function in an if statement then what would be your recommendation to extract only the row values in either the Then or Else columns. This function would only find 1 unique row


#4

Ok i seem to have achieved what I needed. I could not seem to use the simpler example but here is my process so far.

//To extract one row with a value of another you need to use the following
PREV_AR_DT.Select(“INVOICE=’"+row(“INVOICE”).ToString+"’”)
Then assign to a temp array
The to get an item of that array you use
invoiceTempArray(0).Item(0).ToString


#5

Hi @bbimuyi,

Convert.ToString(PREV_AR_DT.Select(“INVOICE=’"+row(“INVOICE”).ToString+"’”)(0)("ColumnName"))
Or
Convert.ToString(PREV_AR_DT.Select(“INVOICE=’"+row(“INVOICE”).ToString+"’”)(0)(0))

Regards,
Arivu


#6

Looks like the single apostrophes were throwing me off. They were pointing backwards. I updated to this and it worked

“Simple Method “+Convert.ToString(PREV_AR_DT.Select( “INVOICE=’”+row(“INVOICE”).ToString+”’”)(0)(“CURRENT”))

Thanks for your help!!