Custom Aircraft Currency Example: Hangar fees for N514CG paid within the past 30 days
In this example, we will create a custom aircraft currency definition that checks for an expense record of type "Hangar Fees" for aircraft N514CG within the last 30 days.
Creating the definition
- 1. Go to the Custom Aircraft Currency Definition screen, under the Aircraft Logbook menu.
- 2. Under "Currency Name", enter a name for this currency, for example, "Hangar fees N514CG".
- 3. Under "Currency Period", enter 30 in the field and select "Days" from the drop-down.
- 4. Leave the initialization script blank.
- 5. Enter the loop script as shown below:
var ac_id = getfieldstr("Aircraft ID"); var exptype = getfieldstr("Expense Type"); if (strequal(ac_id, "N514CG") && strequal(exptype, "Hangar Fees")) 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 Aircraft Currency screen.
How it works
This is an aircraft currency definition rather than a pilot currency definition. This means that the loop script in this example is executed for all aircraft expense, inspection, and maintenance records in the last 30 days.
In this example, we look at two attributes from the aircraft expense record: Aircraft ID and Expense Type. The && operator means "and". So, if the Aircraft ID for a particular record is N514CG, and the Expense Type for the same record is Hangar Fees, then our currency is valid.