Template Variable Name (Field)- Uses & Formulas

This page contains examples of how and where the 'Template Variable' field can be used in Price agreements.

The following variables all represent a numerical value from an order, and can be used alone to pull this data from an order to formulate a price. The variable should be used in conjunction with the 'Template variable below' field.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 FootprintInSqFt FootprintInM2 InboundCrewCount InboundPaxCount InboundTransitPaxCount InboundNonTransitPaxCount MtowKg MtowLb MtowTon OutboundCrewCount OutboundPaxCount OutboundTransitPaxCount OutboundNonTransitPaxCount ScheduledArrivalDay ScheduledDepartureDay SeatCount TotalFuel

Alternatively, whereby the required figure cannot be pulled from an order using the above variables, an Order Calculated Custom Value may be created and used. When this is the case, a formula is used within the Custom Value and in order to use this value, it must be prefixed by ‘Custom-' in order for it to work correctly.

When these fields are used within a Price Agreement, the product should also use the Custom Value Quantity Calculator with the Custom Property name inserted as a setting

EXAMPLES:

Applying a surcharge based on Ground Time:

In the below example, a surcharge is applicable on top of the Handling Fee when the ground-time exceeds 2-hours.

An Order Order Calculated Custom Value called 'GroundTimeMins' is setup to calculate the number of minutes the A/C is on the ground :

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 ((Func<string>)(() => { var result = "~~"; var mostActualDepartureDateTime = (DateTime?)input.GetOrderField("MostActualDepartureDateTime"); var mostActualArrivalDateTime = (DateTime?)input.GetOrderField("MostActualArrivalDateTime"); if (mostActualDepartureDateTime.HasValue && mostActualArrivalDateTime.HasValue) { var onGroundMinutes = (mostActualDepartureDateTime.Value - mostActualArrivalDateTime.Value).Duration().TotalMinutes; return $"{onGroundMinutes:0}"; } else { result = "0"; } return result; }))();

This value is setup to show the calculated minutes on the Order Screen:

The rate of 25% is applicable as a Surcharge when the ground-time exceeds 120-Mins.
The price agreement therefore shows a 0.00 rate when the GroundTimeMins is below 121-Mins:

Within the product, the price calculator settings are as follows:



Applying a price based on specific Flight Type, Pax Count & MTOW:

The following formula looks at Flight Type, Pax Count, Seat Count & MTOW to return a numeric value which can be used to define a price. The formula decides whether a flight is considered ‘Air Taxi’, based on these factors. The number 1 is returned if the answer is Yes, and 0 is returned if the answer is No:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 ((Func<string>)(() => { { var commercialFlights = new List<string> { "Air taxi", "Charter", "Commercial" }; var flightType = (string)input.GetOrderField("FlightTypeOut") ?? ""; var isCommercial = false; if (commercialFlights.Any(f => f.ToLower() == flightType.ToLower())) isCommercial = true; if (!isCommercial) { return "0"; //"Private Flight"; } else { var seatCount = (int?)input.GetOrderField("NumberOfSeats"); if (!seatCount.HasValue) return "0"; //"Number of seats is missing. Required for commercial flights"; var paxOut = (int?)input.GetOrderField("PaxCountOut"); var hasPaxOnBoard = paxOut.HasValue && paxOut.Value != 0; var hasBelow10PaxSeats = seatCount.Value <= 10; if (hasPaxOnBoard) { if (hasBelow10PaxSeats) return "1"; //"Air Taxi"; else return "0"; //"Charter"; } else // has no pax on board { var mtowkg = (int?)input.GetOrderField("MTOWkg") ?? 0; var isBelow5_699 = mtowkg <= 5_699; if (isBelow5_699) return "1"; //"Air Taxi"; else return "0"; //"Charter"; } } } }))();

A price agreement can then be formulated to apply a price if the answer is ‘Yes', and apply 0.00 if the answer is ‘No’. The numbers allow the response ‘Yes' / ‘No’ to be used in the 'Template Variable Below’ field. As this Custom value is compiled using a formula, it must be inserted into the ‘Template Variable Below’ field using the 'Custom-’ prefix: