This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Array.prototype.where = function (condition) { | |
return this.filter(condition); | |
}; | |
Array.prototype.select = function (attributes) { | |
return this.map(attributes); | |
}; | |
Array.prototype.sum = function () { | |
return this.reduce((a, b) => a + b, 0); | |
}; | |
Array.prototype.average = function () { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Getting Gregorian Date from Julian Column: | |
CASE WHEN [JULIAN] IS NULL OR [JULIAN] = 0 THEN '' ELSE CAST(CAST(CAST(((CAST(([JULIAN]-MOD([JULIAN],1000))/1000 AS INT)+1900)*1000)+MOD([JULIAN],1000) AS CHAR(7)) AS DATE) AS CHAR(10)) END | |
-- Getting Time from 6-digit time (130045 = 1:00:45pm) | |
CAST(SUBSTR([TIMESTR],1,2) || ':' || SUBSTR([TIMESTR],3,2) || ':' || SUBSTR([TIMESTR],5,2) as TIME) | |
-- Current Date in JDE Julian Format: | |
select (YEAR(NOW()) - 1900) || LPAD(DAYOFYEAR(NOW()),3,'0') from sysibm.sysdummy1; | |
--or | |
select (100000+(YEAR(curdate())-2000)*1000+dayofyear(curdate())) from sysibm.sysdummy1; |