September 28, 2020, 04:11 AM
nox[SOLVED]why 'function' return '*' as my result?
Hi,
I have define a Function in Iway Datamigrator as following:
DEFINE FUNCTION FUN1(PARAM1/HYYMDS XDEFAULT '1900/01/01 00:00:00')
FUN1/A32V=CONCAT( TO_CHAR( (HPART( PARAM1, 'YEAR', 'I4' ) - 1911) ), SUBSTRING( DT_FORMAT( PARAM1, 'HYYMDS' ), 5, 27 ) );
END
and I define a column named "New_Date" with:
DF.functions/chinese_year.FUN1(HUM_DATE)
and my HUM_DATE(HYYMDS) contain:
2013/06/20 11:10:47.443
2013/06/20 11:10:55.160
2013/06/20 11:25:40.563
2013/06/20 11:27:05.030
2013/07/23 16:56:08.407
but I end up with:
*******/06/20 11:10:47
*******/06/20 11:10:55
*******/06/20 11:25:40
*******/06/20 11:27:05
*******/07/23 16:56:08
any idea why?
Note: When I try FUN1 by input parameter manual and I get : 102/06/20 11:10:47.443
as expected.
This message has been edited. Last edited by: nox, September 29, 2020, 11:21 AM
dbeaganThis is an odd bug. Using the TO_CHAR function with I4 data in a DEFINE FUNCTION causes the asterisks.
Fix it by changing the I4 to an I5.
DEFINE FUNCTION FUN1(PARAM1/HYYMDS XDEFAULT '1900/01/01 00:00:00')
FUN1/A32V=CONCAT( TO_CHAR( (HPART( PARAM1, 'YEAR', 'I5' ) - 1911) ), SUBSTRING( DT_FORMAT( PARAM1, 'HYYMDS' ), 5, 27 ) );
END
TABLE FILE car
PRINT COUNTRY
COMPUTE HDATE/HYYMDS = '2013/06/20 11:10:47.443';
COMPUTE DEFUNC/A32V = FUN1(HDATE);
COMPUTE NOFUNC/A32 = CONCAT( TO_CHAR( (HPART( HDATE, 'YEAR', 'I4' ) - 1911) ), SUBSTRING( DT_FORMAT( HDATE, 'HYYMDS' ), 5, 27 ) );
END
September 29, 2020, 11:24 AM
ClifIt works for me in the current 8207.17 release. Please confirm the synonym describes the input field correctly. Other than that, sorry no idea.
September 30, 2020, 11:39 PM
noxHi dbeagan,
Thanks, Solved the problem. I think it is a bug... why 'I5' work while 'I4' is not working in Function? It's weird.
Hi Clif,
the version I test was on 8.206.773 version...latest for 8.206 for now.