Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Programming Microsoft Dynamics??? NAV 2015

You're reading from   Programming Microsoft Dynamics??? NAV 2015 Sharpen your skills and increase your productivity when programming Microsoft Dynamics NAV 2015

Arrow left icon
Product type Paperback
Published in Jul 2015
Publisher
ISBN-13 9781784394202
Length 644 pages
Edition 1st Edition
Arrow right icon
Toc

Table of Contents (12) Chapters Close

Preface 1. An Introduction to NAV 2015 2. Tables FREE CHAPTER 3. Data Types and Fields 4. Pages – The Interactive Interface 5. Queries and Reports 6. Introduction to C/SIDE and C/AL 7. Intermediate C/AL 8. Advanced NAV Development Tools 9. Successful Conclusions A. Review Answers Index

Finishing the processing code

Next, we will create the C/AL code to calculate a Fan's age (in years) based on his/her 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 divide by 365 (not worrying about Leap Years) and round down to integer years (if someone is 25 years, 10 months and 2 days, we will just consider them 25). In the following code, we did the division as though the result were a decimal field. But 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 to include that fan in our output data (SelectThisFan set to True). This code will select each fans who fits any of the checked criteria; there is no combination logic here. Following is our commented C/AL code for Report 50002:

Finishing the processing code

After this version of...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image