Hi Everyone,
I scraped data and the value of datatable is like this(you may refer to the attached file). In line 18-20 i want to get the value of Advance Interest which is 40.
Hi Everyone,
I scraped data and the value of datatable is like this(you may refer to the attached file). In line 18-20 i want to get the value of Advance Interest which is 40.
the value in this datatable is dynamic
hi, @rpaforum
use this LINQ on your DataTable dt:
advanceInterest = dt.AsEnumerable().
Where(Function(r) r("Item Appraisal Value").ToString.Trim = "Advance Interest").
Select(Function(r) r.ItemArray.
Skip(1). 'skip the first column (label)
First(Function(c) Not String.IsNullOrWhiteSpace(c.ToString))).
First().ToString
If you need it as a number:
advanceInterestValue = CDbl(advanceInterest)
Hi @rpaforum,
Since your DataTable has a label column and a dynamic value column (like “2,100.00”), you need to filter by the label and then read the value column.
Use this LINQ expression:
dt.AsEnumerable().
Where(Function(r) r(“Item Appraisal Value”).ToString.Trim = “Advance Interest”).
Select(Function(r) r(“2,100.00”).ToString).
FirstOrDefault
This will return 40.00.
If the amount column name changes, replace “2,100.00” with the correct column name or use column index instead.
Hi @rpaforum
You can use for each in data table - data table as dt
Inside for each Use if condition
row(“Item Appraisal Value”).ToString.Trim = “Advance Interest”
Assign the value advanceInterest = row(“2,100.00”).ToString
And exit the loop
Hope this solution work
Cheers
This works! Thank you! ![]()
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.