Applies to: Player 5.7 for ArcGIS Pro


The Data Importer is used to import data into a Player project. Data is imported from a source dataset and can be mapped from source features to Player features. Attribute values are typically imported directly from source columns, and one or more source columns can be used to populate a Player attribute.


In many cases a direct import is sufficient. However, where values need to be calculated, reformatted, combined, or converted, the Importer provides an Expression field. Expressions use the syntax of the Flee expression language and allow values to be manipulated during the import process.


This article outlines the structure and usage of the most common expressions. If you require an expression that is not covered here, please contact Player Support for further assistance.


Text

Text can be concatenated using the + symbol. This can be used to join two or more text fields together. Any literal text that is added must be enclosed with quotation marks.


Example


        disc_well_name + " | " + country_names


The example uses two fields, disc_well_name and country_names, both of which must be added to the Field Definition box (Well Name in this case). The | symbol is inserted between the two field values, with a space on either side, to separate them in the output.

Output: Moki 1ST1 | New Zealand


Numbers

Normal arithmetic operators can be used with numbers and numeric fields in expressions. Fields must be of a numeric data type, such as Short Integer, Long Integer, Big Integer, Float, or Double. These fields can be used with operators such as + (add), - (subtract), * (multiply), / (divide), and % (modulus) to perform calculations.


Example


        net_thickn_max_val_feet / gross_thickn_max_val_feet * 100.0


The expression calculates the percentage of the gross thickness that is net thickness. The value in net_thickn_max_val_feet is divided by the value in gross_thickn_max_val_feet, and the result is multiplied by 100.0 to convert it to a percentage. For example, if the net thickness is 50 feet and the gross thickness is 100 feet, the result would be 50%. 


Dates

When importing date information, such as a spud date, source data that is already stored as a date can be imported directly without any additional formatting. However, if the source data is stored as text or a string, the date format must be specified so the importer can correctly interpret the values. You can specify one or more date formats that may appear in the source data. If multiple formats are possible, separate them with a vertical bar ( | ). The import process will try each format in turn until a match is found.


Example

        

        dd MMMM yyyy | MMMM yyyy | yyyy


This expression allows dates such as 15 May 2015, May 2015, and 2015 to all be successfully imported into the same Date attribute column.


Source ValueFormat Matched
15 May 2015dd MMMM yyyy
May 2015MMMM yyyy
2015yyyy



Substitute a value for a Player value

The switch function evaluates a value and returns the result associated with the first matching value or condition.

It is most useful when translating a known list of input values into a standardised set of output values. This is particularly useful to translate source values into prescribed Player values.


There are two supported syntaxes:


Option 1

switch(expression1, result1 [, expression2, result2]...)


switch(content="oil", "Proven oil",
content="dry", "No shows",
       true, "Unevaluated")  


Option 2

switch(expression, value1, result1 [, value2, result2]...)


switch(content,

       "oil", "Proven oil",

       "dry", "No shows",

       true, "Unevaluated")


The second syntax is typically preferred when matching a single attribute against a list of values, as it avoids repeating the attribute name in each comparison. The first argument is usually an attribute from the input dataset. 


Example


    switch(content,

         "oil & gas shows","Gas shows",

         "oil shows","No shows",

         "hydrocarbon shows","Gas shows",

         "oil","No shows",

         "gas","Proven gas",

         "gas w oil shows","Proven gas",

         "oil w gas shows","Gas shows",

         "gas shows","Gas shows",

         "dry","No shows",

         "oil, gas & cond","Proven gas",

         "gas & cond","Proven gas",

         "gas,cond w oil sh","Proven gas",

         "oil & gas","Proven gas",

         true,"Unevaluated"

    )


The Switch function evaluates the value of the content field and compares it against a series of value and result pairs. For each pair, the first value is the hydrocarbon description to match, and the second value is the classification to return if a match is found. The function works through the pairs in sequence and returns the classification associated with the first matching description. For example, if content is "gas", the function returns "Proven gas". If content does not match any of the specified descriptions, the final true condition acts as a default and the function returns "Unevaluated".


Conditional Expressions

A conditional expression evaluates one or more conditions and returns a result based on whether those conditions are true or false. Conditional expressions are useful when you want different values to be returned depending on the data. 


If Function

The If function evaluates a condition and returns one value if the condition is true and another value if the condition is false.


Syntax

        If( condition , true_value , false_value )

  • condition – The expression to evaluate.
  • true_value – The value returned if the condition is true.
  • false_value – The value returned if the condition is false.


Example


        if( deviation_type = "Vertical" or isnull( deviation_type ) ,"No" , "Yes" )


The following expression checks whether the deviation_type field is equal to "Vertical" or contains a null value. If either condition is true, the expression returns "No". If deviation_type contains any other value, the expression returns "Yes".



IfNull function

Null is the absence of any value. The IfNull function checks whether a value is null and returns an alternative value if it is. If the value is not null, the original value is returned. 

IfNull(value, replacement_value)


Example


        ifnull( oil_recoverable_pp_mmbbl , 0 ) 


The expression checks whether the field oil_recoverable_pp_mmbbl contains a null value. If it does, the expression returns 0. Otherwise, it returns the value stored in oil_recoverable_pp_mmbbl


Combining Functions and Statements

Expressions can combine functions and conditional statements, including nested functions and conditions, to produce the required output.


Example


    if( ons_offshore="Offshore" , ifnull( water_depth_meter, 0 ) , ifnull( ground_elevation_meter, 0 ) * -1 ) + "m"


This expression uses if and nested ifnull statemetns. It first evaluates the condition ons_offshore = "Offshore". If the condition is true, water_depth_meter is evaluated for a null value; if it is null, 0 is returned, otherwise the value of water_depth_meter is returned. If the condition is false, ground_elevation_meter is evaluated for a null value; if it is null, 0 is returned, otherwise the value of ground_elevation_meter is returned and multiplied by -1. Finally, "m" is appended to the result to indicate the value is in metres.


Example


switch(

     ifnull(OIL_RECOVERABLE_PP_MMBBL, 0) > 0 and ifnull(GAS_RECOVERABLE_PP_MMSCF, 0) > 0,"Oil and Gas",

     ifnull(GAS_RECOVERABLE_PP_MMSCF, 0) > 0,"Gas only",

     ifnull(OIL_RECOVERABLE_PP_MMBBL, 0) > 0,"Oil only",

     true, "Unevaluated"

)


This example shows nested ifnull functions within a switch statement. The switch function evaluates each condition in turn and returns the value associated with the first condition that evaluates to true. First, it checks whether both OIL_RECOVERABLE_PP_MMBBL and GAS_RECOVERABLE_PP_MMSCF contain values greater than zero, treating any null values as 0. If true, "Oil and Gas" is returned. If false, it checks whether GAS_RECOVERABLE_PP_MMSCF is greater than zero and returns "Gas only" if true. If false, it checks whether OIL_RECOVERABLE_PP_MMBBL is greater than zero and returns "Oil only" if true. If none of these conditions are met, the final condition true acts as a default and "Unevaluated" is returned.