Reading through data scraping extract table to retrieve select data

Scenario:

Data scrape the below table from a website, want to return every value in the in the transaction date column. Then with the rows and columns returned add up the transaction amount. So for example variable (a) with the value 03/09/2022 00:00:00 (MM/dd/yyyy) and variable (b) with the value 04/13/2022 00:00:00 (MM/dd/yyyy) so any thing inbetween these two date will be returned so that would be “Thursday 24-Mar-2022” and “Friday 08-Apr-2022”.

Once the dates inbetween the two variable have been returned i want to add up any scheduled payments amounts that returned with these days so that would be the two values £535.90 and £535.94.

what’s the best way to tackle this scenario

@duaine.b

  1. Use extract table to extract the data from website
  2. Then use a for each row in datatable activity to loop theough the datatable
  3. Now inside the loop use a if condition with
    Date.Compare(datetime.parseexact(currentrow("date olumnname").ToString,"dddd, dd-MMM-yyyy",System.Globalization.CultureInfo.InvariantCulture,datetime.parse(variablea) > 0 and Date.Compare(datetime.parseexact(currentrow("date olumnname").ToString,"dddd, dd-MMM-yyyy",System.Globalization.CultureInfo.InvariantCulture,datetime.parse(variableb) <0 which will compare if the input date is between variablea and variableb or not
  4. In the then side use assign for sum = sum + cdbl(currentrow(“totalscolumnname”).Tostring.Replace("£”,””).Trim)…Type of sum is double

Hope this helps

Cheers

@Anil_G currently when i try this there’s an error, would to be able to advise on this? the image shown below.

variable a (in_inceptionDate) is type string
variable b (exposureDate) is type string

@duaine.b

Please use this …there are few brackets missing

Date.Compare(datetime.parseexact(currentrow("date olumnname").ToString,"dddd, dd-MMM-yyyy",System.Globalization.CultureInfo.InvariantCulture),datetime.parse(variablea)) > 0 and Date.Compare(datetime.parseexact(currentrow("date olumnname").ToString,"dddd, dd-MMM-yyyy",System.Globalization.CultureInfo.InvariantCulture),datetime.parse(variableb)) <0

cheers

@Anil_G thanks for you help it looks like the error is gone but now this is the issue i face when running the process. In the image the first value is variable a (string) and the next is variable b (string). would you know how to get around this
image001

@duaine.b

In place of datetime.Parse use this

datetime.parseexact(Variable1.trim,"MM/dd/yyyy hh:mm:ss",System.Globalization.CultureInfo.InvariantCulture)

Repeat same for variable2 as well

cheers

Perfect, thank you this is working now

1 Like

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