u_condition
Provide a DBMS-independent profile for selection in read and selectdb statements.
u_condition (SelectionExpression)
Example: read u_condition(vConditions)
Parameters
Parameter | Data Type | Description |
---|---|---|
SelectionExpression | String | Conditional expression used as a retrieve
profile, in which:
|
Return Values
For values returned in $status, see read or show, as appropriate. For more information, see read and selectdb.
Value |
Error constant |
Meaning |
---|---|---|
-1301
|
<UPROCERR_SYNTAX>
|
Syntax error. |
-1302
|
<UPROCERR_SERVICE>
|
Function not allowed in service. |
|
<UPROCERR_REPORT>
|
Function not allowed in report. |
-1304
|
<UPROCERR_UNKNOWN_CONTEXT>
|
Function not allowed, unknown context. |
-1305
|
<UPROCERR_EXPRESSION>
|
Expression not allowed. |
-1306
|
<UPROCERR_CONDITION>
|
Condition not allowed. |
-1307
|
<UPROCERR_EXTRACTION_EXPR>
|
Extraction expression is a condition. |
-1308
|
<UPROCERR_INDIRECTION>
|
Indirection followed by brackets. |
-1309
|
<UPROCERR_PARENTHESES>
|
Operand followed by parentheses. |
-1310
|
<UPROCERR_BRACKETS>
|
Operand followed by square brackets. |
-1311
|
<UPROCERR_UNRESOLVED_OPERAND>
|
A field, parameter, or variable could not be found in current context. |
Use
Allowed in all component types.
Description
You can use the u_condition clause with read or selectdb ProcScript statements to provide a runtime retrieve profile for selecting data.
Note: u_condition cannot be used with u_where. The u_where and u_condition clauses are very similar. However, the u_condition clause is interpreted at run time, whereas u_where is interpreted at compilation.
The SelectionExpression generated from the u_condition clause is passed to the DBMS connector. This data is limited to 8192 bytes. In addition, a maximum of 45 retrieve profile characters can be entered, which includes those on the u_conditionand those entered in fields by the user; if the search profile of a single field exceeds 512 bytes, it is truncated to 512 bytes.
Using u_condition
When defining an expression in ProcScript, follow
the rules for string substitution, which uses %%
to include operators and
quotation marks. For more information, see Substitution in String Values. For example:
$uconditions$ = "fld_date >= $date(%%"22-APR-17%%")"
When expressions are provided by the end-user (for
example, in a profile field), this is not required. For example, the following expressions could be
entered by an end-user, where the right-side operand (fld_xxxx
) are fields of an
entity in the component:
fld_numeric > 1 & fld_numeric < 6 fld_string = $uppercase("amsterdam") fld_string = userdefinedfunction(FLD_STRING) fld_boolean = 0 fld_boolean = "F" fld_date >= $date("22-APR-17") fld_date >= "20170422" fld_time >= $clock("05:06:07") fld_time >= "050607";22 April 2017 05 hours 06 minutes 07 seconds:fld_datetime >= $datim("22-APR-17 05:06:07") fld_datetime >= 2017042205060700
u_condition is interpreted at
runtime, so the value of the $uconditions$
component variable in the following
example provides a variable retrieve profile.
; read trigger of Entity Service component trigger read read u_condition($uconditions$) end