If/Then/Else

Check rules accept If/Then/Else statements that enables you to create more complex conditional tests on the Add/Edit as Text tab. This statement provides a primary path of execution when the if statement evaluates to "true," and a secondary path of execution when the if statement evaluates to "false."

Using the If/Then/Else statement, you can use custom-field values within reports as warning messages and flags.

In the following example, when the Result is between 100 to 1500, the Check Report with Warning prints "Amount between 100 and 1500." The example references three data accounts:

  1. 24000050: 1000

  2. 24000055: 500

  3. 24000060: 10

This calculation for this example is 1000 + 500/10, with the result of 1050.

The script is written using Jython code:

 def runVal():
       dbVal=abs((|,,,,,BERLIN,24000050,[ICP None],[None],[None],[None],[None],,,,,,,,,,,,,,,,|)+(|,,,,,BERLIN,24000055,[ICP None],[None],[None],[None],[None],,,,,,,,,,,,,,,,|)/(|,,,,,BERLIN,24000060,[ICP None],[None],[None],[None],[None],,,,,,,,,,,,,,,,|))
       PstrCheckMessage1=''
msg2=''
msg3=''
       if(dbVal<100):  
          RESULT=True
          PstrCheckMessage1='Amount < 100.'
       elif(dbVal>100  and dbVal<=1500):
          RESULT=True
          PstrCheckMessage1='Amount between 100 and 1500.'
       elif(dbVal>1500  and dbVal<=9999):
          RESULT=True
          PstrCheckMessage1='Amount between 1501 and 9999.'
       else:
          RESULT=False
          PstrCheckMessage1='Amount greater than 9999!'
       return [RESULT,PstrCheckMessage1,msg2,msg3]

Note:

You must include three message parameters with the return statement to write data to the status table. If you write only a single message, two other message parameters are required.

The result of running this script is shown in the Check Report with Warnings:


Image Check Report with Warning