Converting Dates

 7 Replies
 0 Subscribed to this topic
 52 Subscribed to this forum
Sort:
Author
Messages
KerriR
Advanced Member
Posts: 34
Advanced Member

    I have variables defined as

    datevar = Date
    datestringAGS = String
     
    In an Assign node, I have added this javascript
    datevar= pfDate(qryAppInfo_BIRTHDATE,'yyyymmdd')
     
    datestringAGS= getDateAGS(datevar)
     
    Where qryAppInfo_BIRTHDATE is a date field from a table. When I run the flow, I get these errors:
     
     Exception while evaluating expression: datevar= pfDate(qryAppInfo_BIRTHDATE,'yyyymmdd');
    TypeError: Cannot find function substring. (threadScript#119)
    Exception while evaluating expression: datestringAGS= getDateAGS(datevar);
    TypeError: Cannot find function getFullYear. (threadScript#168)
     
    I’m totally confused as to why I’m getting them as I’m using PFlow supplied functions. Anyone have any ideas?

     

    JudeBac
    Veteran Member
    Posts: 129
    Veteran Member
      Can you try this:

      BD_Date=getDateAGS(qryAppInfo_BIRTHDATE);
      pfDate(BD_Date,'yyyymmdd');
      KerriR
      Advanced Member
      Posts: 34
      Advanced Member
        I think it's because we are using Java 1.5 and getFullYear and substring are not valid functions in that version. I am verifying that now and will update when I have results.
        Shane Jones
        Veteran Member
        Posts: 460
        Veteran Member

          KerriR,
          What you have listed does not look correct to me - ** IF ** you really have a date formatted as yyymmdd to start you would not need to getDateAGS. I have a flow that does the same thing you are trying to do and it is working fine. My flow pulls a date from PA52 that is in AGS format and I want to show it in an email so I changed it to a DME and it works perfectly.

          AGS - yyyymmdd
          DME mm/dd/yyy

          I am thinking you are using the wrong pfdate format... If your starting date variable is already yyyymmdd you would not need to convert it to an AGS date with the getDateAGS. I think you need to look at what your date is starting as and what you are trying to get when it is converted.

           

          This might help - If you want to convert dates try this:

          yyyymmdd TO mm/dd/yyyy
          stdatevar = yyyymmdd
          stdateDME = getDateDME(pfdate(stdatevar, 'yyyymmdd'))

          mm/dd/yyyy TO yyyymmdd
          stdatevar = mm/dd/yyyy
          stdateAGS = getDateAGS(pfdate(stdatevar, 'mm/dd/yyyy'))

          Shane Jones
          Tools: HR, Payroll, Benefits, PFI, Smart Office, BSI, Portal and Self-Service
          Systems: Lawson, Open Hire, Kronos, Crystal Reporting, SumTotal Learning
          ** Teach others to fish...
          masonp
          Posts: 3
            It looks like this hasn't been updated in a while and I'm not sure if it was resolved, but I'd like to contribute the solution I came up with when I ran into this problem...

            It looks like the pfDate function has trouble converting a date when it's coming directly from a query.  If you assign the date from the query to a string variable first, and then use it in the pfDate function it should work.

            Example:

            Instead of doing this:

            pfDate(Query_DATE_VALUE, 'yyyymmdd')

            do this:

            pfDate(dateValueString, 'yyyymmdd')
            rogowsky
            Basic Member
            Posts: 5
            Basic Member
              Hi,

              I am curious as well as to the solution for this issue.  I have also tried to convert a date to string without success.  I receive the same error for each of the three functions. 

              Exception while evaluating expression: strHireDate = DateString(QEmployee_DATE_HIRED,'yyyymmdd');
              TypeError: Cannot find function getFullYear. (threadScript#441)
              Exception while evaluating expression: strAdjHireDate = getDateAGS(QEmployee_ADJ_HIRE_DATE);
              TypeError: Cannot find function getFullYear. (threadScript#168)
              Exception while evaluating expression: strTermDate = getDateDME(QEmployee_TERM_DATE);
              TypeError: Cannot find function getFullYear. (threadScript#148)

              It was mentioned above that the version of Java might be the issue.  I am wondering if it is my PC.  I have used these functions for other flows.  Since writing those I have upgraded my PC to a Window 7 64-bit machine.  Any thoughts would be appreciated.
              JudeBac
              Veteran Member
              Posts: 129
              Veteran Member
                Try this (in Process Variables). The order they are declared is important

                Date dateHireDate = pfDate(QEmployee_DATE_HIRED,'yyyymmdd')
                String strHireDate = getDateDME(dateHireDate)

                rogowsky
                Basic Member
                Posts: 5
                Basic Member
                  I have since found a KB in Lawson Extreme.  A JT was created and this is fixed in a version I will not be upgrading to anytime soon.

                  KB 1340377

                  Can't find getFullYear function


                  Description:
                  Can't find getFullYear function

                   Affected Products & Releases:

                  Affected Product

                  Affected Release

                  Patch Status

                  Notes

                  S3 ProcessFlow

                  9.0.1.7


                  Reference Number: JT-237121