How it works…

The flag field that we set up simply adds an indicator against the records that fall within the rules we established. Now that we have identified the records from 2015, we can use this flag in the expression to calculate across those records.

The real-world difference between using a flag to identify the records in 2015 and just using set analysis to identify the record directly will be almost nothing. The preceding code is a very simplified example of turning business logic into a flag indicator to be used later on. Once you have a grip on the concept and implementation, the same method can be used to add a level of complex and detailed business logic to a binary yes or no flag. Instead of writing the complex If-then-Else logic in the chart expressions, it is always advised to move it to the backend script and create flags. The flags are then used in the frontend expressions, thus making them more efficient.

Adding as much of the business logic to the script as possible makes everything much quicker and simpler to read. This way, you don't have to look at each chart before making a change; you can make it in one place only and the change will propagate through the whole application.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset