Custom Pilot Currency Example: 3 Instrument Approaches in 3 Calendar Months

From ZuluLog Wiki
Jump to: navigation, search

In this example, we will create a custom currency definition that checks for at least three instrument approaches within the last three calendar months.

Creating the definition

1. Go to the Custom Pilot Currency Definition screen.
2. Under "Currency Name", enter a name for this currency, for example, "3 Approaches in 3 Calendar Months".
3. Under "Currency Period", enter 3 in the field and select "Calendar Months" from the drop-down.
4. Enter the initialization script as shown below:
var dayapps = 0, ngtapps = 0;

5. Enter the loop script as shown below:
dayapps = dayapps + getfieldnum("Day Inst Apps");
 ngtapps = ngtapps + getfieldnum("Night Inst Apps");
 if (dayapps + ngtapps >= 3)
   currency_ok = 1;

6. Enter a description for this currency if you wish, and then save it.
7. After saving the definition, you can check the status of your custom currency from the View Pilot Currency Detail screen.

How it works

The initialization script creates the variables dayapps and ngtapps, and sets them both to zero. These variables will be used to keep track of the number of day instrument approaches and night instrument approaches, respectively. We're doing it this way because the Flight Entry screen has separate fields for day approaches and night approaches.

In this example, the loop script is executed once for each flight within the last 3 calendar months. For each flight, we call getfieldnum("Day Inst Apps") and getfieldnum("Night Inst Apps") to look up the number of day and night approaches, and we add these to the variables dayapps and ngtapps.

Finally, we check the sum of dayapps and ngtapps. If it's greater than or equal to 3, then our currency is valid, so we set currency_ok to 1.

Personal tools