EGL Development User Group

EGL Development User Group

EGL Development User Group

The EGL Development User Group is dedicated to sharing news, knowledge, and insights regarding the EGL language and Business Developer product. Consisting of IBMers, HCL, and users, this community collaborates to advance the EGL ecosystem.

 View Only
  • 1.  Null date being returned as current date

    Posted Sat February 11, 2012 05:20 PM
    I have a library function used to convert an integer date (CYYMMDD) to an EGL Date. In some cases the seven digit date does not exist and therefore has a zero value. In the conversion function, I check for a zero value and then try to return a null date. However, instead of the null date being returned, I get the current date returned. Is there something I'm doing wrong.

    I've cut the code down to the essence of what happens below. The library, a test program that uses the library, and the result returned from the library function to the test program.

    Library Code:
    package com.busapp.wb.svc.lib;   library SynonDateConversionLib type BasicLibrary{}   function Convert(cyymmddDate int in) returns(date) mmddyyyyDate date?; defaultDateFormat = "MM/dd/yyyy";   mmddyyyyDate = null; return(mmddyyyyDate);   end end


    A test program using the library:
    package com.busapp.wb.svc.pgm; import com.busapp.wb.svc.lib.*; // basic program // program TestDateConversion type BasicProgram {} function main() cyymmddDate int = 0; dateOut date? = SynonDateConversionLib.Convert(cyymmddDate); writeStdOut("dateOut = " :: dateOut); end end


    and the result returned to the program:
    dateOut = 02/11/2012
    SystemAdmin


  • 2.  Re: Null date being returned as current date

    Posted Sat February 11, 2012 06:14 PM
    Hi Bob,

    Try changing your library function to return a nullable date by using the question mark in the "returns":

    function Convert(cyymmddDate int in) returns(date?)

    Right now it's defined as returning a non-nullable date, so your null field "mmddyyyyDate" gets converted to the default value for its type, which is the current date for the date type.

    -Justin
    jspadea


  • 3.  Re: Null date being returned as current date

    Posted Sat February 11, 2012 06:19 PM
    That solved my problem. Thanks
    SystemAdmin


  • 4.  Re: Null date being returned as current date

    Posted Fri May 08, 2015 03:55 AM

    I have the same problem. I want to convert a specific value type date of records to null string ("")

    but it returns current date when I set the date value to null.

    michaeldefox


  • 5.  Re: Null date being returned as current date

    Posted Fri May 08, 2015 03:59 AM

    I remove the {@XMLElement{nillable=true}} from the records generated by the wsdl-extract client interface-wizzard.

    Bram_Callewaert