I have developed the following code. Its throwing bot error. but if i execute it manual it is working fine. When integrating into A360 not working.
Â
import re
import datetime
def Pull_LatestDate_RowLocation(input_1):
  with open(input_1,'r') as file:
    Read_lines = file.readlines()
  result = "\n".join(line.rstrip()if isinstance(line,str) else line for line in Read_lines)
  table_data = str(result)
  # initialize latest date variable to None
  latest_date = None
  # iterate through each row in the table
  for i, row in enumerate(table_data.strip().split('\n').1:], start=1):
    # extract the date from the row using regular expressions
    date_match = re.search(r'\d{2}tA-Z]{3}\d{4}', row)
    if date_match:
      # parse the date string into a datetime object
      date_str = date_match.group()
      date_obj = datetime.datetime.strptime(date_str, '%d%b%Y')
      is_XE_occure = re.search(r'\b{}\b'.format(re.escape("AD")),row)
      is_OO_occure = re.search(r'\b{}\b'.format(re.escape("RT")),row)
      # compare the date to the current latest date
      if latest_date is None or date_obj > latest_date:        Â
        if is_OO_occure:
          latest_date = date_obj
          row_Loc = row
        if is_XE_occure:
          latest_date = date_obj
          row_Loc = row
  return row_Loc
Â
Note:
Session Name : Find_Loc
-Â Function Name :Â Pull_LatestDate_RowLocation.
- Input Argument : Passing the file path.
- Running Enterprise
- manually working
- A360 Not working