Forum Discussion

gdave's avatar
gdave
Regular Contributor
6 years ago
Solved

aqDateTime

Hi all

 

I was trying to validate a date which is displayed on my screen. I am using below Code Expression to confirm that the date displayed is yesterday's date however I get an 'Exception' error message :"Unable to evaluate the operation's "Value" parameter. Error: Undeclared identifier: CurrentDate"

 

My Code is as below:

aqConvert.DateTimetoFormatStr(aqDateTime.AddDays(CurrentDate, -1), '%d/%m/%Y')

 

Can anyone please confirm the correct script as I doubt above is incorrect. Thanks

 

  • CurrDate is not something built in to the aqDateTime, not sure we're you're getting that. 

     

    I think what you're looking for is aqDateTime.Today()

     

    aqConvert.DateTimeToFormatStr(aqDateTime.AddDays(aqDateTime.Today(),-1),'%d/%m/%Y')

8 Replies

  • Marsha_R's avatar
    Marsha_R
    Champion Level 3

    I am guessing that you read the date off the screen and put it in CurrentDate?  Since we can't see the rest of your code, I'm also guessing from the error message that the variable isn't available to this part of the code.

     

    Also make sure that CurrentDate is an actual date and not a string, since that is what aqDateTime is looking for.

    • gdave's avatar
      gdave
      Regular Contributor

      Marsha_Rwrote:

      I am guessing that you read the date off the screen and put it in CurrentDate?  Since we can't see the rest of your code, I'm also guessing from the error message that the variable isn't available to this part of the code.

       

      Also make sure that CurrentDate is an actual date and not a string, since that is what aqDateTime is looking for.


      No, I just wish to read the date of the screen.

       

      So the date displayed on the screen is yesterday's date. I used property checkpoint with property/method as 'text', condition:equals, value: code expression. Hope this make sense. Cheers

  • m_essaid's avatar
    m_essaid
    Valued Contributor

    yes, I bet your date variable is string, not a date... maybe convert it into DateTime before taking off one day...

    • gdave's avatar
      gdave
      Regular Contributor

      m_essaidwrote:

      yes, I bet your date variable is string, not a date... maybe convert it into DateTime before taking off one day...


      Can you please give an example.....

      • cunderw's avatar
        cunderw
        Community Hero

        CurrDate is not something built in to the aqDateTime, not sure we're you're getting that. 

         

        I think what you're looking for is aqDateTime.Today()

         

        aqConvert.DateTimeToFormatStr(aqDateTime.AddDays(aqDateTime.Today(),-1),'%d/%m/%Y')