The Condition System

Previous  Next |  Direct link to this topic

ValidationSystem_ConditionSystem

 

When the trigger system is in place, you have the option to use the condition system. The condition system allows you to react to something, but only if that something upholds certain conditions.

 

Sample: Business Partner – React to the new activity button being pressed (trigger), but only if the chosen BP type is Customer (condition).

 

The condition system allows you to use one of three conditions:

Condition

Description

No condition

This basically means that there is no condition, but the tied universal function should be activated each time the trigger occurs.

Field

Description

Universal Function

Select the Universal Function you would like to activate.

Simple condition

In the simple condition, you can check on specific fields value and see if it meets the wanted requirements to activate the Universal Function

Field

Description

Item

The item you want to check for a value

Column

If the above item was a matrix or a grid, which column you want to check

Comparison

Here you decide how you want to compare the items value against the expected value

 

Comparison types are:

        Equals

        Not Equals

        Greater than

        Greater than or equal

        Less than

        Less than or equal

        Contains (Only strings)

        Does not contains (Only strings)

        Starts with (Only strings)

        Ends with (Only strings)

        Does not Starts with (Only strings)

        Does not Ends with (Only strings)

Value

Here you enter the expected value you want if the Universal function should activate. Please note that when expected values are validated, it is done using invariant formats

Type

Description

String

Word for word and case sensitive

Numbers

No thousands separators

Currency (Floats)

Decimal-separator= .

Thousands-separator = ,

Dates

YYYY-MM-DD (2007-04-20 = 20th of April 2007)

Value Type

Here you need to tell the system how it should treat the value from the item when comparing it to the expected value.

 

Value types are

        String

        Number (Integer)

        Currency (float)

        Date

Universal Function

Select the Universal Function you would like to activate if condition is true.

SQL Condition

Finally, you have the option to use SQL and its dynamic values to do a complex validation based on SQL, or use it to determine one of several Universal Functions to use.

 

First you need to create you SQL, which in most cases will have an IF/ELSE or a CASE/WHEN Structure (You can select such from the Common SQL combo box). In the SQL you can use the syntax $[$<ITEM>.<COLUMN>.<TYPE>] for dynamic values from items and $[<TABLE>.<FIELD>.<TYPE>] for data sources (Both work very similar to formatted searches).

NB. IF YOU USE AN ITEM THAT DOES NOT HAVE A COLUMN THEN SET THE COLUMN PART TO 0.

 

Types you can use:

Type

Description

0

As STRING

STRING

Treat as is

NUMBER

Convert to number

CURRENCY

Removes any Currency Indicators that might be and convert to a number

DATE

Converts to a data in format YYYY-MM-DD

Sample on Business Partner that does Universal Function OPT1 if BP is a Customer I, else OTP2:

 

IF($[$40.0.0]) = ‘C’

 BEGIN

  SELECT ‘OPTION1’ FOR BROWSE

 END

ELSE

 BEGIN

  SELECT ‘OPTION2’ FOR BROWSE

 END

You now have two values that your condition can output (The string “OPTION1” or “OPTION2”).

These can now be entered into the Condition Result Matrix where you decide what should happen for each result by assigning a Universal Function code

ValidationSystem_SQL_Condition

You do not need to provide a Condition result for all output your SQL can give… Just the ones you would like to react to…

 

You can use the result of the SQL condition result in the triggered Universal function by using the keywords.

-         $[B1VALRESULT.STRING]

o   To get the result as string

-         $[B1VALRESULT.NUMBER]

o   To get the result as a number. this will fail if the result is not a number

NB: PLEASE NOTE THAT THE CONDITION-RESULTS ARE CASE-SENSITIVE

NB: IN SAP HANA IT IS NOT POSSIBLE TO MAKE SQL IF/ELSE SENTENCES. INSTEAD USE THE SELECT CASE … FROM DUMMY SYNTAX

 

 

SQL condition keywords

Universal functions can use the result of a B1 validations SQL condition there activated them, by using the following syntax.

$[B1VALRESULT.COLNAME.STRING]

$[B1VALRESULT.COLNAME.NUMBER]

$[B1VALRESULT.COLNAME.DATE]

Where the COLNAME is the name of the column in the SQL statement.

If your SQL condition statement result in more than one record, values from the first record is used.

clip0071

NB: Column names must not contain the characters (| ( ) "space" ; $) and these will be replaced with a underscore.