Hello ,
The purpose of this article is to demonstrate and explain how
Query functions for
String, Value,
Date and Boolean works.
This will help Comp Admins to achieve when there is a complex requirement, by trying to construct the
Formula and assign in a
rule for Pipeline calculation to
generate results;
Comp Admin will create a custom SQL
SELECT Statements in a efficient way that results to return within
5 seconds incase it will be a session run time out and results won't be appearing.
Admins to ensure that the uptime, performance are taken care.
SQL Statement will have parameter condition to set and to be inserted in Plug-in table (
TCMP).
By running the pipeline job, rule gets processed and calls the custom SQL query during the stages so that you can get derived results out of it.
Context Variables: The following context variables can be used to reference values in the current processing context:
- $pipelineRunSeq - current pipeline run's pipelineRunSeq
- $pipelineRunDate - current pipeline run's startTime
- $modelSeq - current pipeline run's modelSeq
- $periodSeq - current pipeline run's periodSeq
- $calendarSeq - current pipeline run's calendarSeq
- $processingUnitSeq - current pipeline run's processingUnitSeq
- $periodStartDate - current pipeline run period's startDate
- $periodEndDate - current pipeline run period's endDate
- $lastDateInPeriod - current pipeline run period's lastDate (i.e. endDate minus one second)
- $tenantId - current tenantId
- $positionSeq - current position in the processing
- $positionName - name of the current position in the processing
- $positionEffectiveStartDate - effectiveStartDate of the current position in the processing
- $positionEffectiveEndDate - effectiveEndDate of the current position in the processing
- $positionProcessingStartDate - processingStartDate of the current position in the processing
- $positionProcessingEndDate - processingEndDate of the current position in the processing
- $positionCreditStartDate - creditStartDate of the current position in the processing
- $positionCreditEndDate - creditEndDate of the current position in the processing
- $payeeSeq - current payee in the processing
- $ruleSeq - current rule in the processing
- $planSeq - current plan in the processing
- $salesTransactionSeq - current sales transaction in the processing (only apply in Allocate stage)
- $compensationDate - compensation date of the current sales transaction in the processing (only apply in Allocate stage)
- $salesOrderSeq - current sales order in the processing (only apply in Allocate stage)
- $creditSeq - current credit in the processing (only apply in Allocate stage)
Parameter Variables: The following parameter variables can be used as values in the input parameter of the query function:
- $1 - value of the first String parameter in the Query function. (first String parameter)
- $2 - value of the second String parameter in the Query function (second String parameter)
- $3 - value of the first Value parameter in the Query function (first Value parameter)
- $4 - value of the second Value parameter in the Query function (second Value parameter)
- $5 - value of the first Boolean parameter in the Query function (first Boolean parameter)
- $6 - value of the second Boolean parameter in the Query function (second Boolean parameter)
- $7 - value of the first Date parameter in the Query function (first Date parameter)
- $8 - value of the second Date parameter in the Query function (second Date parameter)
Let's go overview to understand more details about it.




Assign the Formula to a Rule based on Rule usage

Insert the SQL Select Statement to
CS_Pluginquery Table





Insert the SQL Select Statement to CS_Pluginquery Table




Insert the SQL Select Statement to CS_Pluginquery Table





Using above use-cases, Pipeline results are generated for the functions ;
Query for String , Boolean , Date & Value

Note : If SQL Select Statements are not inserted, will receive
pipeline errors as shown here below


Disclaimers
- SELECT Statement results should return within 5 seconds else timeout(or it will be canceled)
- Ensure you have SPACE after the parameter
- Allowed ONLY SELECT Statements.
- No UPDATE, INSERT & DELETE Statements allowed.
- No Stored Procs or Packages to call
- If the query returns multiple rows, only the first row's value will be considered.
