C# filter expressions can be used to apply additional filtering on top of the basic report filters that can be selected when downloading a report. You can create expressions to which each column in the report must match. The advantage of using these expressions is that you do not have to manually filter in the report anymore, the file size is reduced so report generation is much quicker.
A C# filter expression is an expression that determines if the given 'row' object (report column) should be included in the output of the report. Make sure that the columns used in the expression are included in the report query columns.
row["Column name"]. Filter on the column name for the query, the column must exist and match exactly as shown in the query.
row[“Custom property name“]. Filter on the custom property for the query, the custom property must be added to the query as a new column and match exactly as shown.
Filter expression examples
Below are some examples of Report C# filter expressions:
C# filter expression to only include certain values from a column in the report, for example only certain services/products. Note some examples may be used across different queries if the column exists.
To filter on a group of values in a specific column, this is the general format:
All column values must be written in lower case.
row["Column Name"] != null &&
(row["Column Name"].ToString().ToLower() == "column value 1"
|| row["Column Name"].ToString().ToLower() == "column value 2"
|| row["Column Name"].ToString().ToLower() == "column value 3")
To include orders at specific Handling Stations only
Excludes orders with order fare type "scheduled" or “confirmed”, excludes secondary orders, and excludes orders with operator set as Netjets EU or Netjets USA.
var state = (string)row["OrderState"];
var flightType = (string)row["BGR Flight Type"];
var operatorShortName = (string)row["OperatorShortName"];
// Order must be requested or confirmed
var isMatch =
string.Equals(state, "requested", StringComparison.InvariantCultureIgnoreCase)
|| string.Equals(state, "confirmed", StringComparison.InvariantCultureIgnoreCase);
// And not a scheduled flight
isMatch = !string.Equals(flightType, "scheduled", StringComparison.InvariantCultureIgnoreCase);
// And a primary order
isMatch = row["Secondary order number"] == null;
// And not a wiggins or fedex
isMatch = !string.Equals(operatorShortName, "wigginsairways", StringComparison.InvariantCultureIgnoreCase)
|| !string.Equals(operatorShortName, "fedex corp. - feeder", StringComparison.InvariantCultureIgnoreCase);
Exclude split orders if the "secondary order number' is not referenced in the report query (Crew/Pax query) e.g AMS-509-2
Include certain services/products and exclude services with amount 0.
To Include multiple products based on product code whilst excluding services with zero price. Note: All product codes must be written in lower case.
var amountInclVat = (decimal?)row["Amount Incl. VAT"];
var product = row["Product"]?.ToString()?.ToLower();
return amountInclVat.HasValue && amountInclVat.Value != 0M &&
product != null && (product == "jet a retail (usa)" || product == "jet a cost plus (usa)" || product == "jet a fixed price (usa)");
Exclude certain services/products.
To exclude multiple products that contain similar text (for example an FBO Location prefix) only filling in that text will suffice to exclude all the products that contain that text. All product codes must be written in lower case.