Skip to main content

How to use Function option in a business rule

The Function data source option is useful when calculating values that uses SQL (Get Date, Coalesce, etc) or Equus (Exchange Rate Get, CDR Line Item, etc) functions. When any of the components (Table

Updated over 2 weeks ago

The Function data source option is useful when calculating values that uses SQL (Get Date, Coalesce, etc) or Equus (Exchange Rate Get, CDR Line Item, etc) functions.

When any of the components (Table Lookup, Math or Function) is selected, a pop-up window is displayed giving the possibility of performing one out of four actions:

Function Selector.png
  • Create New - to create a new record

  • Copy Existing - to create a new record from copy an existing one

  • Select Existing - to reuse a previously created record

  • Run Existing - to execute the source, and given an entered context - Assignment ID, Cost Estimate ID or Cost Estimate Line Item ID - retrieve the result

To create the condition of IF the number of days in an assignment = 180 for Step 2 in the below example, the user can select the Function option to use SQL functions to calculate the difference between two specific dates. First select Function as the option.

Adding Function Component

For this example, we will be creating one from scratch. Select Create New option from the Function selector. The Function pop up window appears. Enter a name for the function and select the Function from the drop down list. There is a total of 44 available functions that can be used as part of Business Rule.

Adding Function Component - New

Select the SQL "Datediff" function from the Function drop down list. This function retrieves the difference between two dates and details about the selected function including the syntax appears in the Functions Information section colored in blue. In the Parameters section, populate the mandatory field(s). For these Function parameters, any of the Data Source components available to use including other functions.

Adding Function Component - New Datediff

Rather than selecting a Database Field for the two dates, Functions will be selected to use the SQL "Coalesce" function instead. Using this function allows the logic to look at a more than one database field and retrieve the first non-null value that it finds. This is useful when a date such as the assignment end date can be populated in a number of fields within the Equus Platform such as in the “Actual End Date“, in the “Scheduled End Date“ or others. To do this configuration, select Function for the Date 1 parameter. You can use the function selector to define this. For this example, we will be creating one from scratch. Select Create New option from the Function selector.

Populate the Name field and select "Coalesce" from the Function drop down list. Next select "DateTime" as the Data Type and click

Add Parameter.png

. In this example, two date fields will be checked so two parameters are required

Adding Function Component - New Coalesce

By selecting Relocation Effective Date and Start Date as the parameters, the function will take the value of the Relocation Effective Date, and it if it is null, it will then used the Start Date field. To test the function on an Assignment ID, Cost Estimate ID or Cost Estimate Line Item ID, click

run button

or

save & run button

otherwise click

save button

for the changes reflect to the configuration.

Function - Coalesce

After creating the Start Date Coalesce function, create a Coalesce function for the End Date. The Datediff function should look like the below screenshot. At this point, click

run button

or

save & run button

to test the Datediff function or click

save button

for the changes reflect to the configuration.

Function - Datediff

Once Datediff function is saved, close the window to return to the business rule to continue updating the business rule.

Things to Note

Did this answer your question?