Create calculated expressions
The expression editor is used to create formulas and other calculated expressions. It is available for many types of fields; when it is available for a field, the Expressions button on the ribbon will become active.
You can use a variety of data as function arguments. Available arguments are listed on three tabs depending on their type. The Periodic tab lists all variables which contain multiple values. The Scalar tab lists variables that have a single value. The Well tab allows you to use production forecasts from the Decline workspace. The System tab lists other items such as case and scenario names, period, and node type.
Use the Validate button to test whether the expression is accepted as valid.
Clicking the Clear Expression button will delete the expression completely.
The list of available functions includes standard mathematical and statistical functions, as well as custom functions specific to Dataflow. When you select a function from the list, its description is displayed in the Function Description box, including the required arguments. The custom functions are explained in the table below.
Function | Description |
---|---|
CONVERTTOREAL(variable, [currency]) |
Returns the values of the periodic numeric variable in real terms. variable: a periodic numeric variable currency: an optional parameter for currency code. This should only be used if either the input or output variable is not set to default currency and should be set to the expected currency of output currency. Example: If template currency is USD, and scalar variable is in EUR and needs to show the total for periodic variable [Var1], the expression would have these parameters: TOTAL(CONVERTTOREAL([Var1], “EUR”)) |
CUMULATIVE(periodic_variable) | Gets the cumulative periodic values of the given periodic variable. Example: If Var1=1,2,3,4,5, CUMULATIVE([Var1]) = 1,3,6,10,15 |
CUMULATIVERANGE(variable, start, end) |
Calculates the cumulative range value of a periodic variable:
Example: If Var1=1,2,3,4,5 over a period 2010 to 2014.
|
DATE(year,month,day) | Generates a date representation of the supplied year, month and day. This type of date is independent of regional settings and date format. Example: DATE(2010,1,31) represents January 31, 2010. |
DATEADD(datepart, number, date) |
Returns a specified date with the specified integer number interval added to a specified datepart of that date where:
Example: DATEADD(“y”,1,“1 January 2010”) represents 1 January 2011. Note: This function will not evaluate if the resultant date is less than 1 January 0001 or greater than 31 January 9999. |
DATECOMPARE(date1, date2) |
Compares the supplied dates and returns: date1 > date2: -1, date1 = date2: 0, date1 < date2: 1 date1 and date2 can be date variables or text values. Text values will be converted to dates using the current regional settings. Example: DATECOMPARE("1 January 2000", "1 January 2010") gets a value 1. DATECOMPARE("1 January 2010", "1 January 2000") gets a value -1. |
DATEPART(date, datepart) |
Extracts the parts of a supplied date field and returns a number. date can be date a variable or a text value. Text value of 'date' will be converted to date using the current regional settings. datepart is: y for Year, m for Month, or d for Day. Examples:
|
DATETEXT(date, [format]) |
Converts the supplied date to text. If the optional [format] argument is supplied, the date will be formatted using this exact representation, otherwise the current regional settings will be used. Examples: DATETEXT([DateVariable1]), DATETEXT([DateVariable1],““MM/dd/yyyy””). Common format specifiers: d day 1 - 31 dd day 01 - 31 M month 1 - 12 MM month 01 - 12 MMM abbreviated month name, e.g. Jan, Feb MMMM full month name yy year 00 - 99 yyyy 4-digit year |
DATETONUMERIC(date) | Converts the supplied date to a numeric representation (OLE Automation date). Example: DATEONNUMERIC("1 January 1900") gets a numeric value 2. |
DEFERREDRATE(production, deferment) | Defer future production based on a specified deferment schedule. production is a periodic variable in volume per period. deferment is a periodic variable which represents the deferment percentages. Result: A periodic variable of deferred production rates. |
FIRSTNONZERODATE(periodic_variable) | Finds the first non-zero value of the specified periodic variable and returns the date of the period in which it occurs. The function returns null if no non-zero values are found. |
FIRSTNONZEROPERIODINDEX(periodic_variable) | Finds the first non-zero value of the specified periodic variable and returns the zero-based index of the period in which it occurs. The function returns -1 if a non-zero value is not found. |
GETCASENAME(current_cases, category) | Returns the case name parsed from the supplied current_cases argument, for the specified category. current_cases: text descriptor of the current scenario's cases e.g. the [Current Cases] system variable. category: the variable category e.g. 'Production', 'Capital', 'Opcosts'. |
GETHIERARCHYPART([Hierarchy Location], part_id) |
Returns the hierarchy part parsed from the supplied hierarchy location variable according to the supplied part identifier. part_id can be either the hierarchy level (0 = root node, 1 = first level, etc.), the level name (“Country”, “Region”, etc.), or a special identifier (“_last” = last node, “_parent” = parent of last node). Examples: Consider an expression is being set to the node 'CompanyName/RegionName/Consulting'. 1. GETTHEHIERARCHYPART([Hierarchy Location],2) will get the name of the node at level 2 in the hierarchy path, i.e. Consulting. 2. GETTHEHIERARCHYPART([Hierarchy Location],"Company") will get the name of the Company level node in the hierarchy path. |
GETHIERARCHYPATH([Hierarchy Location]) |
Using the system variable [Hierarchy Location] this function will return just the path portion of that variable. Example: Given a node that is in the hierarchy 3 levels down, GETTHEHIERARCHYPATH ([Hierarchy Location]) will return a text representation of the names of all the nodes to traverse to get to that node, e.g. "Root Node Name\Parent Node Name\Current Node Name" |
GETLISTPROPERTY(listvariable, property) |
Returns the property value for the selected value from the list associated with the supplied variable at a template level. listvariable: a scalar variable with associated list property: the name of list property for the list referenced by the variable Example: A list is created to store a list of countries with properties for notes (note) and country codes (code). List is then associated with variable CountryInfo 1. GETLISTPROPERTY("CountryInfo","note"), will get the value for the currently selected country notes 2. GETLISTPROPERTY("CountryInfo","code") will get the value of the currently selected country code, i.e.UK |
GETPRICESCENARIODATA(price, scenario) |
Returns the periodic values of a product stream's linked price given the scenario. price: the price linked to the product selected from the Price tab in the Function Arguments section. scenario: price deck scenario name. Example: GETPRICESCENARIODATA([Oil 1 Price],"High") |
GETSCENARIODATA(scenario, variable) | Returns data for the specified variable and scenario. |
GETSCENARIODATABYTAG (scenariotag, variable) |
Returns data for the specified variable and scenario using the scenario tag value. scenariotag is a valid (active or inactive) scenario tag. variable is a scalar or periodic variable which is available from the list of variables. Example: GETSCENARIODATABYTAG("Default", [Oil.Production] Example: GETSCENARIODATABYTAG("1C",Production oil) will get the value of the variable <Production.Oil> for scenario tagged as <1C> |
GETWELLRATE(variable, product, [date]) |
Returns periodic values representing the production rate of specified product of the well variable. The periodicity of the values is defined by the template. The optional date argument will offset the values to start at the specified date.
Example: 1. GETWELLRATE (WellVariable,"Condensate", DATE(2016,1,1)) 2. GETWELLRATE (WellVariable, "Water", ScalarDateVariable) |
GETWELLVOLUME(variable, product, [date]) |
Returns periodic values representing the production volume of specified product of the well variable. The periodicity of the values is defined by the template. The optional date argument will offset the values to start at the specified date.
Example: 1. GETWELLVOLUME(WellVariable, "Condensate", DATE(2016,1,1)) 2. GETWELLVOLUME(WellVariable, "Water", ScalarDateVariable) |
GETWORKBOOKDATA(variable, workbook_range) | Returns data from the range in the spreadsheet associated with the supplied variable. |
IF(logical_test, value_if_true, value_if_false) | Returns one value if a condition you specify evaluates to TRUE and another value if it evaluates to FALSE. |
LINEITEM(variable, line_item_ID) | Returns the value of the line item in a multilevel table specified by the supplied variable and ID (see Tables and line items). variable: a periodic numeric variable with associated line item(s). line_item_ID: the numeric identifier of the line item, for example 1 for the first line item. |
MAXPERIODIC(periodic_variable) | Finds and returns the maximum value within the specified periodic variable. |
NUMERICTODATE(numeric) |
Converts the supplied numeric representation (OLE Automation date) to a date. numeric is a supplied numeric representation (OLE Automation date). Example: NUMERICTODATE(2) gets the date 1 January 1900. Note: The numeric value must be between -657435 to 2958466. |
NPV(rate, variable, [discountdate], [discountmethod], [donotdiscounthistoricalperiods]) |
Returns the net present value of an investment based on a discount rate and a series of values. Discount data and method can be optionally specified to define how NPV is calculated. rate: a scalar value that represents a discount rate that will be used in calculations. Can either be a scalar variable or entered in the expression. variable: a periodic numeric variable (usually represents a cash flow) discountdate: (optional) datetime or user entered date that specifies when NPV needs to be applied from. If not specified, the document's start date is used discountmethod: (optional) the discount method. The default method is Monthly, other possible methods are: Annual Start, Annual Mid, Annual End. donotdiscounthistoricalperiods (optional): boolean value that controls whether historical periods are discounted or not. Default value is false. Examples: 1. NPV(rate1, cashflow) - calculate NPV for cashflow1 using the rate stored in variable rate1. 2. NPV("10", cashflow2, "12/31/2015", "Annual Start", "true") - calculate NPV for cashflow2 using constant rate, annual start discount method and discount historical periods. |
PARSEDATE(text, [format]) |
Converts the supplied text to a date. If the optional format argument is supplied, the date will be parsed using this exact representation, otherwise the current regional settings will be used. Examples: PARSEDATE(“31 January 2010”), PARSEDATE(“01/31/2010”,“MM/dd/yyyy”). Common format specifiers: d day 1 - 31 dd day 01 - 31 M month 1 - 12 MM month 01 - 12 MMM abbreviated month name, e.g. Jan, Feb MMMM full month name yy year 00 - 99 yyyy 4-digit year |
PRODUCTIONANALOG(variable1, variable2) |
Simulates the type curve well approach. variable1 is a periodic variable which represents a time series curve profile, in volume per period. variable2 is a periodic variable which represents a drilling plan, in number of wells per period. Result: An analog style time series output in resultant volume. Example: PRODUCTIONANALOG(variable1,variable1) where variable1 (in Mbbl) = 1,2,3,5,5,4,3,2,1 variable2 (in wells) = 2,2,2,3,3,1,1,0,0. The output is (in Mbbl) = 2,6,12,23,35,44,51,53,47. |
RANGE(variable, start, end) |
Calculates the total value of a periodic variable for the given range. variable: periodic variable. start: range start year. end: range end year. Example: If Var1=1,2,3,4,5 over a period 2010 to 2014. 1. Integer range parameters RANGE([Var1],1,3) = 9,9,9,9,9 2. Date range parameters RANGE([Var1],"1/1/2011","12/1/2013") = 9,9,9,9,9 Note: If the expression is assigned to a Scalar variable, the function will return only one value which is the sum of the given range values. |
ROR(variable, [DiscountMethod]) | Returns the ROR of the periodic numeric variable. variable: a periodic numeric variable DiscountMethod: an optional parameter for discount method, value should be either Monthly, Annual Start, Annual Mid, Annual End. |
TOTAL(periodic_variable) | Returns the total (sum) of the supplied periodic variable's values over all periods. |
VALUEBYOFFSET(variable, offset, [default]) | Returns the value of the supplied variable for the period specified by the offset. For example, an offset of -1 will return the previous period's value. The optional default value is used if no value is available for the given offset. |
VALUEBYPERIODINDEX(variable, index, [default]) | Returns the value of the supplied variable for the period specified by the zero-based index. For example, an index of 0 will return the first period's value, 1 the second, etc. The optional default value is used if no value is available for the given index. |
VALUEBYSUBCATEGORY(variable, subcategory, [default]) | Returns the value of the supplied variable for the index specified by the subcategory. |