Custom Pilot Currency Example: 6 Night Rotorcraft Landings in Last 60 days

From ZuluLog Wiki
(Difference between revisions)
Jump to: navigation, search
Line 37: Line 37:
If '''totngtldgs''' is greater than or equal to 6, then our currency is valid.
If '''totngtldgs''' is greater than or equal to 6, then our currency is valid.
[[Reference Manuals|← Return to Reference Manuals]]

Latest revision as of 20:27, 6 November 2014

In this example, we will create a custom currency definition that checks for a total of at least 6 night landings in a rotorcraft within the last 60 days.

Creating the definition

1. Go to the Custom Pilot Currency Definition screen.
2. Under "Currency Name", enter a name for this currency, for example, "6 Night Rotorcraft Ldgs in 60 Days".
3. Under "Currency Period", enter 60 in the field and select "Days" from the drop-down.
4. Enter the initialization script as shown below:
var totngtldgs = 0;

5. Enter the loop script as shown below:
var nldg = getfieldnum("Night Full Stop"); 
var rotor = getfieldnum("Rotorcraft"); 

if (rotor > 0.0)
  totngtldgs = totngtldgs + nldg;

if (totngtldgs >= 6)
  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

In the initialization script, we create a variable totngtldgs to track the number of night landings in rotorcraft across all flights in the last 60 days.

In the main script, we get the rotorcraft time and number of night landings for each flight. If the rotorcraft time is greater than zero, we know this is a flight in a rotorcraft, so we add the night landings for this flight to the overall total.

If totngtldgs is greater than or equal to 6, then our currency is valid.

Personal tools