Loading...

Condition Expressions

Condition Expressions are specified in Ruleset tables and are used for dynamically evaluating the rows being processed to determine whether an output should be generated or not. The Condition Expression column must contain a C# expression that returns a Boolean value.


Methods

The following methods can be used in a Condition Expression. In addition to these methods, all APIs from the System namespace in mscorlib.dll is available.

double? Value()

When used in a Spawner Ruleset Condition expression, returns the Value of the row currently being processed. If the row is produced by the Distributer, Value() returns the distributed value for the current period. If not, Value() returns the raw value of the Computation Source Column from the Data Store.

T CurrentPeriodValue<T>()

If used when the Distributer is enabled, and the transaction being processed is generated by the Distributer, this function returns the value of the Time Frame Column in the Data Store that has a date matching the Transdate of the generated row. The Transdate of the generated row is created form based on the Time Frame information of the distribution factor column that was used for generating the value of the transaction. If used when the Distributer is not enabled, this function returns the value of the Time Frame column being processed, meaning the Computation Source Column must be a Time Frame column.

Example

Given the example below, the Computation Source Column is "Total". The source row also has "property" columns Col01, ..., Col06 with some additional information. When the Distributer is run, it produces the output in table 3.

Data Store

AccountIDTotal...Col01 2016.01.01...Col06 2016.06.01
Xyz1001...0

Distributor Ruleset

AccountIDP01 2016.01.01P02 2016.02.01...P06 2016.06.01
Xyz0.30.4...0.5

Distributed transactions

#AccountIDAmountTransdate...
1Xyz302016.01.01...
...............
6Xyz502016.06.01...

When calling CurrentPeriodValue<int>() from the Spawner for row number 6, 0 is returned. The reason for this is that Transdate of row number 6 matches the Time Frame date of column Col06 in the Data Store.

bool CurrentPeriodValueNotNullOr<T>(T value)

Checks if the value of the Computation Source Column for the current time slot is not equal to NULL or the provided value.

Example
Check if the value of the current time slot is not null or equal to 100.

CurrentPeriodValueNotNullOr<decimal ?>(100)

T ValueOfCurrentDistributionKey<T>() double? CurrentDistributionValue

Checks if the value of the Computation Source Column for the current time slot is not equal to NULL or the provided value.

Example
Check if the value of the current time slot is not null or equal to 100.

CurrentPeriodValueNotNullOr<decimal?>(100)

bool TransDateIsNull()

Checks if the current time slot (Trans Date) is NULL.

bool TransDateIsNotNull()

Checks if the current slot (Trans Date) is not NULL.

int YearNum()

Returns the year of the current time slot

Example
Check if the year of the current time slot is 2015.

YearNum() == 2015.

int Month()

Returns the month of the current time slot.

int Day()

Returns the day of the current time slot.

DateTime? CurrentTransDate


Properties

The following properties can be accessed in a Condition Expression. In addition to these properties, any column in the row currently being processed from the data source definition of the pipeline component can be read as a property.

DateTime?CurrentTransDate

Returns the date of the current time slot.

Example
Check if the month of the current time slot is 5 (May)

CurrentTransDate.Value.Month == 5

Using Columns as Properties in a Condition Expression To read values from the columns of the source row currently being processed in a Condition expression, simply refer to it as a property as shown in this example, where AccountID in the row being processed is compared to the text "A1000".

CurrentPeriodValue<decimal?>() > 1000 && AccountID == "A1000"

Note that you always need to consider the data types of the members in your expression. If a column is of type string (text, nvarchar, etc), you need to compare it to a string value (enclosing the value in quotation marks).