PrevPrev Go to previous topic
NextNext Go to next topic
Last Post 02/10/2016 7:39 AM by  Chesca
Input date validation
 4 Replies
Sort:
You are not authorized to post a reply.
Author Messages
Chesca
Programmer/analyst
State
Veteran Member
(1028 points)
Veteran Member
Posts:482


Send Message:

--
02/08/2016 2:20 PM

    We have a custom batch program that validates input date from a csv file. The date is never formatted properly and sometimes could be mddyy, mmddyy, or mmdyy. We want the date to be reformatted as mmddyyyy. 

    If the input date is 8 digits and mmddyyyy. then continue processing. Otherwise, check if the date length and fix it. Is there a Lawson API I can use to reformat the input date to be mmddyyyy? 

    pbelsky
    Sr Analyst Project Manager
    Weyerhaeuser
    Veteran Member
    (215 points)
    Veteran Member
    Posts:75


    Send Message:

    --
    02/08/2016 2:46 PM
    Does not look like it, but this should be easy to code. If you are interested to see what date processing APIs are available, search the KB for the document called "Doc for Developers: Lawson 4GL Application Program Interfaces" for your version. In my version (9.0.1) the date processing APIs are in chapter 4.
    Chesca
    Programmer/analyst
    State
    Veteran Member
    (1028 points)
    Veteran Member
    Posts:482


    Send Message:

    --
    02/08/2016 2:53 PM
    I didn't find anything in the docs for developers. So I will add logic to the program to check the character length.
    jaherb
    Independent
    Independent
    Veteran Member
    (472 points)
    Veteran Member
    Posts:164


    Send Message:

    --
    02/09/2016 4:20 PM
    There is no API that will take multiple formats of the date and reformat it. You have to get that stabilized into one format and then you can change your csv attributes to match the format easily. If you are reading it into a custom program, once your reformat the date, you can use the 900-IS-DATE-INVALID to check for the correctness of a date. I always did that on pre-conversion programs just to validate them.
    Chesca
    Programmer/analyst
    State
    Veteran Member
    (1028 points)
    Veteran Member
    Posts:482


    Send Message:

    --
    02/10/2016 7:39 AM
    Ok, thank you all. I ended up adding logic to get the input date stabilized into one format and using the 900-IS-DATE-INVALID.
    You are not authorized to post a reply.