Restricted formula for key and parameter values
A subset of Sage X3 scripting language can only be used to supply key or parameter values because they have to be evaluated on the client side.
A valid parameter value can be:
- The name of a property in the instance or of one of its child instances . The path is always given without
this
. For example,PRICE
,ADDLINE.TEXT
. - The context properties, as a particular case of the following parameter values. For example,
ACTX.USER
. - A property in a collection of the current instance (in this case, the collection is seen as a child instance) only if the current property is in the same collection. For example,
COLLECTION.PROPERTY
, which implies using the same index in the collection. - A constant (string or number). For example,
"VEN"
,"SUP"
,"00123"
,3.14
, or678000
. This is only possible if it is the value that transmits the parameter. - A "void" class property; when a parameter needs to be transmitted by pointer and not by value, provided that this parameter is meaningless in the context and will not be used. The dedicated AVOID instance is meant for this.
This
is accepted only if the parameter value is an instance (it must be alone).-
=num$(P)
where P is a property of the class. This is possible only when the following conditions are fulfilled:- The parameter type is
Char
and is sent by value. - The property P has a type that can be
TinyInt
,Integer
,Decimal
,Clob
,Char
,Date
,Decimal
,Uuident
orDatetime
.
- The parameter type is
-
=val(P)
where P is a property of the class. This is possible only when the following conditions are fulfilled:- The parameter type is
TinyInt
,Integer
orDecimal
and is sent by value. - The property P has a type that can be
Clob
,Char
orDate
.
- The parameter type is
The solution for a complex formula is:
- To add a technical property (called TECH_PRO) within the class where the formula must be evaluated. If it is used for a link that is present on a collection, the technical property must be in the collection.
- To use a formula that is the value of the property (TECH_PRO, or =num$(TECH_PRO), or =val(TECH_PRO).
This property is invisible and it is evaluated on the server and sent to the client. The client will then be able to evaluate the formula locally and eventually express a link or another condition.