April 2017
Intermediate to advanced
706 pages
17h 8m
English
Next, we will create the C/AL code to calculate a Fan's age (in years) based on their Birth Date and the current WORKDATE. The logic is simple--subtract the Birth Date from the WORKDATE. This gives a number of days. So, we will divide by 365 (not worrying about Leap Years) and round down to integer years (if someone is 25 years, 10 months, and 2 days old, we will just consider them 25). In the following code, we did the division as though the result were a decimal field. However, because our math is integer, we could have used the simpler expression:
FanAge := ((WORKDATE - "Birth Date") DIV 365);
Finally, we'll write the code to check each Fan record data against our selection criteria, determining if we want ...
Read now
Unlock full access