How do I get text from web, convert to date, and make decision in StudioX

Hi all, I am trying to create an automation to look at a text in a webpage, convert that to a date and then use that date to have my automation select samples based on dates that are older than 1 month from the current date. Thanks for the help!

Hi @Eccarius_Nick

You can consider below approach

  1. extract data using table extraction wizard
  2. then loop through the extracted data and convert the text into date using datetime.parseexact method as below

Use assign activity and create datetime variable and assign it(let’s say datetime variable is out_date)

out_date = DateTime.ParseExact(in_date_string, “yyMMdd-hhmmss”, System.Globalization.CultureInfo.InvariantCulture)

  1. then find the difference between current date and the date fetched.

  2. if greater than 30 days, go to web site.

Now here first you need to figure out
1), when you are looping through datatable. Please define variable name for storing row index as well.
2) Now when this condition is satisfied, you want to go to website and check that box.
3) So first explore the selector of checking that check box. It would have tablerow and tablecol property as well.
4) Now match if that is same as rowindex, it may be 1 minus or plus.
5) Then tweak the selector if that check box with dynamic value as rowindex variable+1 or minus 1 based on what you identified.

That way you will be able to click the check box

Hope this helps.

Regards
Sonali

I suggest doing the free training at academy.uipath.com

@Eccarius_Nick

  1. Use for each ui elment
  2. Use if condition inside it and check the date condition
  3. Check the box on true side and dont do anything on else side

cheers

Hi @Eccarius_Nick

Welcome to UiPath community

Use Get Text to extract webpage text, apply regex \d{8}-\d{5} to find date strings, convert with DateTime.ParseExact(dateText.Substring(0,8), “yyyyMMdd”, Nothing), then check if date is older than one month using If extractedDate less than Now.AddMonths(-1) and select checkbox accordingly.

Happy Automation