chend
(Darren Chen)
January 17, 2019, 2:46am
1
Hi All,
I have scraped some data from a web application and it appears as below:
The number of rows may change from time to time but the ‘Net Unexplained Difference’ will always be the last row. How would I extract and assign the highlighted values?
AkshaySandhu
(AkshaySingh Sandhu)
January 17, 2019, 3:17am
2
Hello @chend
var CCY2-USD = dt.select(“Column-0 like ‘%Net Unexplained Difference%’”)(0)(“Accounted CCY2 USD”).ToString
var CCY2-AUF = dt.select(“Column-0 like ‘%Net Unexplained Difference%’”)(0)(“Accounted CCY2 AUD”).ToString
for more help on DataTable.Select refer below link
chend
(Darren Chen)
January 18, 2019, 2:49am
3
Hi Askshay,
Thank you for the comment, this definitely will be useful.
I have created a work around:
1.To scrape only the 'Net Unexplained Difference" row only
2.This transposes the data into a column, where the ‘Net Unexplained Difference’ becomes the first row of the data.
3.Removed the first row of data.
MAHESH1
(MAHESHKUMAR JV)
January 18, 2019, 4:17am
4
@chend
Let us take you scraped data and stored in a datatable dta
As you told your required value will be always in Last row.
strAccountedCCY2USD= dta.Rows(dta.Rows.Count-1)(“Accounted CCY2 USD”).ToString
strAccountedCCY2AUD= dta.Rows(dta.Rows.Count-1)(“Accounted CCY2 AUD”).ToString
Regards,
Mahesh
chend
(Darren Chen)
January 18, 2019, 4:26am
5
This would be great but the currency can vary e.g. NZD, USD, AUD and so forth.
Would it be possible to replace the currency with *?
E.g. strAccountedCCY2= dta.Rows(dta.Rows.Count-1)(“Accounted CCY2*”).ToString
Regards,
Darren
MAHESH1
(MAHESHKUMAR JV)
January 18, 2019, 4:30am
6
@chend
If the column Index remains same then use column index instead of column Name.
strAccountedCCY2USD= dta.Rows(dta.Rows.Count-1)(1).ToString
strAccountedCCY2AUD= dta.Rows(dta.Rows.Count-1)(2).ToString
Regards,
Mahesh
3 Likes
chend
(Darren Chen)
January 18, 2019, 4:45am
7
Hi Mahesh1,
Thank you for the assistance. This worked out great.
system
(system)
Closed
January 21, 2019, 4:45am
8
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.