Skip to main content
Navigator | Tier 3
June 24, 2022
Question

How to make date comparsion in a360 picking date data from excel. (it works fine in v11) eg date1: 24-06-2022 date2: 20-06-2022 eg If (date1> date2

  • June 24, 2022
  • 4 replies
  • 475 views
How to make date comparsion in a360 picking date data from excel. (it works fine in v11) eg date1: 24-06-2022 date2: 20-06-2022 eg If (date1> date2

    4 replies

    Navigator | Tier 3
    June 24, 2022

    You can use DateTime>Assign to convert the strings to DateTime variables, and then use the DateTime>IsBefore and IsAfter Actions.

     

    Purely as a shortcut, you can use the If>Legacy Automation>Comparison Condition to compare them As-Is without doing the conversion. The first way would be more "best practice"

    pratiktAuthor
    Navigator | Tier 3
    June 26, 2022

    HI @Jeremiah Logan​ 

    Thank you for the explanation ,

    can you share an example of date time conversion

    Can we use the datetime string assign option?

    Navigator | Tier 3
    June 28, 2022

    Sorry for the delay on getting back to you. So yes, you can use the DateTime>Assign option, it is one of several ways you could accomplish this. Here is a real simple workflow that works for me, may not be 100% what you're looking to do, but should give you an idea of how you can tackle your task.

     

    Here is my sample Excel spreadsheet data:

    image 

    In the bot, open with Excel Basic > Open, then loop through all rows with Excel Basic > 'For each row in worksheet'.

     

    On each row, use Datetime:Assign to assign the DueDate and PayDate strings to two different DateTime variables, using a custom format:

    image 

    Use Datetime > Is After to create a Boolean variable and determine whether the PayDate is after the DueDate:

    image.png 

    Then a simple If > Boolean > statement. If bPaidLate = True, pop up a message box that a late fee will be assessed, Else pop up a message that the customer paid on time.

    image

    pratiktAuthor
    Navigator | Tier 3
    June 29, 2022

    Thank You @Jeremiah Logan​