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:
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.
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.
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.
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
. In this example, two date fields will be checked so two parameters are required
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
or
otherwise click
for the changes reflect to the configuration.
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
or
to test the Datediff function or click
for the changes reflect to the configuration.
Once Datediff function is saved, close the window to return to the business rule to continue updating the business rule.
Things to Note
When a function component is saved, it will automatically appear on the Business Rules Components grid













