Example: Flight as Examiner at KSRQ in Last 12 Calendar Months
Initialization script: None (we don't need totals across flights)
Loop script:
var crew_role = getfieldstr("Crew Role"); var route = getfieldstr("Route"); if (strequal(crew_role, "Examiner") && strindex(route, "KSRQ") >= 0) currency_ok = 1; How it works:
The && operator means "and", as in "Crew Role must be Examiner AND
Route must contain KSRQ". By contrast, the || operator means OR,
which means that either check would be enough to satisfy the currency.
getfieldstr instead of getfieldnum
because we're checking text values here, not numeric values.
strequal checks for text strings being equal, and strindex
returns the place that the specified substring ("KSRQ") appears in the larger
string (route). It's zero-based, so it will return 0 (not 1) if the substring
appears at the very beginning. If the substring does not appear it will return -1.
crew_role and route are arbitrary and
can be called whatever you'd like. However, the string "Examiner" must be
spelled and capitalized exactly as it appears in the Role drop-down menu on the
Flight Entry screen.
Initialization script: None (we don't need totals across flights)
Loop script:
var fltrev = getfieldstr("Flight Review"); var actype = getfieldstr("ICAO Code"); if (strequal(fltrev, "Flight Review") && strequal(actype, "R22")) currency_ok = 1; How it works:
We put the value of the Flight Review drop-down into fltrev and the
value of the ICAO Code field (from the corresponding aircraft definition)
into actype . If the flight was a Flight Review and the aircraft's
ICAO code was R22, then this must be a flight review in a R22, and our currency
is valid, assuming we selected the correct period for the currency definition.
|
Version 7.1.1.497 | |
© 2024 ZuluLog LLC All rights reserved | Privacy | Terms of Use |