Back Forward Edit Validate form
Completing the Java tab

About Edit Validate rules

Enter the body of a Java boolean function here. The value your Java code is to validate is in an automatically declared variable named theValue.

Design the function to return true when the value is valid, and otherwise return false. SOLOM 1/19/07REMOVED If the value is not acceptable, include a call to the PublicAPI method failValidate(). TURBT 1/21/03

NoteYour validation code can check character limitations, format limitations, or value range limitations. However, do not implement cross-edits — comparisons of one input field against another — in edit validate rules that are to be used in client-side validation, as the other inputs may not be available at the time the edit validate rule executes.

See More about Function rules and Examples — Using inline Java and PublicAPI facilities for additional guidance on Java code you can use here.

Field

Description

Java Source  
Java

Enter your Java source directly into the text area, Alternatively, click the pencil icon (Pencil) to open your workstation's Java editor or Notepad.

Include a Java return statement in the Java source code.

Enter your Java using the editor, then exit from the editor to return the resulting source code into the form. See open authoring for instructions on setting up a Java editor.

NoteUse the String.equals() Java method, not the == or != operators, to compare the value of a property to a literal string or to the value of another property. C-2461SR-6777 SR-6784 B-24774

You can use the normal Process Commander syntax to call a function rule: B-16506 MIRAT

ruleset_library.FunctionName(arg1, arg2, arg3)

where the RuleSet and library name are in lowercase bu the function name is in exact case. For example: KAUFT 11/1/06 B-24475

double d_result = pegarules_math.Sqrt("4")

Old In releases before Version 4.2SP6, a different fully qualified syntax was employed to call function rules. It still executes correctly, but is deprecated. SR-1136 B-16506 calling functions need fully qualified name

Notes

NoteTo associate text from a message rule with the property, use the addMessage() PublicAPI method, as in following Java statement:

theProperty.addMessage("RuleMessageKey\tText1\tText2...");

where RuleMessageKey is a key to a Rule-Message rule, and the optional Text1, Text2 and so on are text values — separated by a backslash and literal t character — that supply values for the numbered parameters {1}, {2},... in the message rule text. (This method has no effect if the message identified by RuleMessageKey is already present.) R-19895

NoteUse the pre-declared variable myStepPage and the ClipboardPage interface in the Process Commander PublicAPI to access properties on the primary page. F-52 Vidoni

NoteThe standard function callWhen() is useful to evaluate a when condition rule within the Java code. For example:

return com.pegarules.generated.pega_rules_utilities.callWhen(tools, "IsGoodCustomer", tools.getPrimaryPage());

Up About Edit Validate rules