Talsiter Talsiter - 3 months ago 17
Vb.net Question

RDLC Find Value in DataTable

I am attempting to build a report in Visual Studio 2015 using rdlc reporting. I want to be able to lookup a value in my DataTable and display the result on the form.
Here is my DataTable:
DataTable

Is there a function/expression that I can call, that will lookup a value in the DataTable and display the results in my report? My thoughts are something like this:
enter image description here

What I am attempting to do is Lookup the Value "MySummaryType" in the "SummaryType" Column. Once that result is found, in the report it will display the Value of the first record found in "Summary" column.

Obviously the "Lookup" function is not the correct function, however, I am unable to figure out what else it may be.

EDIT:
I am unable to filter the data in the DataTable because the DataTable is expected to return multiple values that are going to be used in the report on subsequent pages.

Answer

Is there a function/expression that I can call, that will lookup a value in the DataTable...?

You can use the DataTable.Select Method to find rows that match your criteria.

Dim matchedRows as DataRow() = myDT.Select("[SummaryType]='MySummaryType'")
If matchedRows.Length > 0 Then
' extract needed field
End If
Comments