Calculate Julian Date on a Gold Form
By Scott Cannon
Have you ever needed to determine the number of days between two dates on a Gold form without leaving it? By creating a subroutine on a form, you will have this capability to use whenever you need it.
Start out by adding a Faux field to your gold form called \JULN. Define the field as an integer with a length of eight digits.
Next, add a subroutine to the gold form. Give it a name of “JULIAN”. Add two parameters to the subroutine. The first parameter should be defined as Date by Value. The second parameter should be defined as Number
by Component.
Put the following code into the code section:
| “\JULN” | = Year of passed date |
| “\JULN#02” | = Month of passed date |
| “\JULN#03” | = Day of passed date |
The rest of the logic is used to calculate the Julian date for the passed date (first parameter). The line of code that assigns a value to P2 is setting the second parameter equal to the Julian date. When you call
the subroutine, the second parameter does not need to be valued because it will contain the Julian date after the subroutine is finished.
For example,
CALL JULIAN WITH “%SYSDATE”, “\DATE”
In this example, “\DATE” will contain the Julian date after the subroutine is finished processing. If you want the values returned from this subroutine to match the value returned by CHPPDVAL using the DAYS function,
you can subtract 2415020 from the value assigned to P2 above.
For more information please contact VCS at 610.444.1233 or vcs@getvitalized.com.