Properties and actions block
The property and action block of the FORM statement adds properties and actions to the form structure.
Syntax
PROPERTIES [(cparam1, ..., cparamN)] [formPropertyOptions] formPropertyDecl1, ..., formPropertyDeclM
Each formPropertyDecl describes the property or action being added to the form structure and has the following syntax:
If the common parameters (cparam1, ..., cparamN) have been specified:
[[alias1] [caption1] =] [ACTION] formPropertyId1 [formPropertyOptions1], ..., [[aliasK] [captionK] =] [ACTION] formPropertyIdK [formPropertyOptionsK]
If the common parameters of the block have not been specified, then:
[[alias1] [caption1] =] formMappedProperty1 [formPropertyOptions1], ..., [[aliasK] [captionK] =] formMappedPropertyK [formPropertyOptionsK]
Each formMappedProperty describes the implementation of a property or action being added to the form and having one of the following syntaxes
[ACTION] formPropertyId(param1, ..., paramN1)
formPropertyExpression
{ formActionOperator }
Each formPropertyOptions specifies options for the property or action being added to the form structure. They can be added one by one in arbitrary order:
changeType
SHOWIF propertyExpression
DISABLEIF propertyExpression
READONLYIF propertyExpression
CLASS propertyExpression
BACKGROUND propertyExpression
FOREGROUND propertyExpression
HEADER propertyExpression
FOOTER propertyExpression
COLUMNS [groupid] (groupName1, ..., groupNameM)
viewType
customView
OPTIONS propertyExpression
sessionScopeType
APPLY
OPTIMISTICASYNC
DRAW groupObjectName
insertPosition
ORDER [USER | FIXED] [DESC]
FILTER [USER | FIXED]
QUICKFILTER formPropertyName
PIVOT calcType
PIVOT LAST [DESC] (propertyExpression1, ..., propertyExpressionZ)
COLUMN
ROW
MEASURE
ON eventType actionId(param1, ..., paramZ) | { actionOperator }
EVENTID eventId
ATTR
EXTID extID
NOEXTID
EXTNULL
IN propertyGroup
imageSetting
STICKY
NOSTICKY
syncType
HINTNOUPDATE
HINTTABLE
Description
One PROPERTIES block adds properties and actions to the form structure. To add a property (action), specify its ID and the form objects whose values will be passed to this property (action) as arguments. Sometimes it’s convenient to list these form objects for the entire PROPERTIES block. To do this, specify the block of common parameters. In this case, when adding a property (action), you only need to specify its ID, while the common parameters will be passed as arguments.
Each property (action) being added to the form structure must have a unique name within the form. This name may be specified either explicitly or based on the name of the property and the passed parameters, i.e. names of objects separated by commas.
FORM order
OBJECTS o=Order
PROPERTIES(o) d=date, Order.number;
In the given example, the names of the added properties date and Order.number will be d and number(o) respectively.
When adding a property (action) to the form structure, you may specify a set of its options. You may also specify common options for the entire PROPERTIES block. If any of the options are specified for both the entire block and a specific declaration, the option value for the declaration will be used.
In all expressions and context-dependent action operators, you can use the names of the objects already declared on the form as parameters.
Parameters
-
cparam1, ..., cparamNList of common parameters of the block. Each parameter is specified with the name of the object on the form. If this list is defined, then adding a property (action) will require that you specify only its ID without parameters. The object name is specified with simple ID.
-
aliasThe name of the property or action being added to the form. Simple ID. If the name is not specified, then the name of the property (action) on the form will be the same as the property's name itself (but without the namespace and signature) with parameters, i.e. names of the objects separated by commas and enclosed in brackets.
-
captionThe caption of the property or action being added to the form. String literal. If the caption is not specified, then the caption of the property (action) itself will be used on the form.
In the current platform implementation, if the name and caption are not specified together, then = is required when using the expressions and action operators (i.e. f(a,b), but =a*b+5)
-
formPropertyIdID of the property or action being added to the form structure.
Alternatively, you may use object operators instead of the property/action IDs:
VALUEdisplays the object value (or the object ID for custom classes).INTERVALdisplays the interval between the values of a pair of objects of the same date or time class.NEWcreates a new object.EDITedits the object.DELETEdeletes the object.NEWEDITcreates and edits a new object.
In addition, you may use brackets to explicitly specify a class whose object will be added/edited (e. g.
NEW[A]) for operatorsNEW,EDIT, andNEWEDITor for property/action IDs. -
ACTIONKeyword. When specified, it is considered that the action is specified in formPropertyId. When not specified, it is initially considered that a property is specified in formPropertyId; otherwise, if property is not found, it is considered that an action is specified in formPropertyId.
-
param1, ..., paramNkList of parameters of the added properties or actions. Each parameter is specified with the name of the object on the form. The number of specified parameters must match the number of parameters for the property or action being added. Not specified if the common parameters block is specified. The object name, in turn, is specified with a simple ID.
-
formPropertyExpressionExpression being added to the form structure.
-
formActionOperatorContext-dependent action operator being added to the form structure.
Options for the property or action
-
changeTypeSpecifying standard handlers for property/action change events. It is specified with one of the keywords:
CHANGEABLEcalls the corresponding handler of the triggered event. Default value. It makes sense to use it explicitly only when another modifier is defined for the entire block but should not be applied to a specific property.READONLYwill either turn on the filtering mechanism or simply ignore the event when the user tries to change the property.DISABLEThe property is not available for changing.SELECTORshows a dialog for changing the current value of the object (not the property value) when the user tries to change the property. Applicable only for properties with one parameter.
-
SHOWIF propertyExpressionSpecifies a property that determines visibility of the property or action being added to the form. If the value of this property is
NULL, then the property (action) being added will not be displayed. Cannot be used together with theHEADERoption.-
propertyExpression
-
-
DISABLEIF propertyExpressionSpecifies a property that determines unavailability of the property (action) being added. If the value of this property is not
NULL, then the property (action) being added will be unavailable. The behavior is similar to theDISABLEoption, but with an additional data-dependent condition.-
propertyExpression
-
-
READONLYIF propertyExpressionSpecifies a property that allows or prohibits changing the property being added (or execution of the action being added). If the value of this property is not
NULL, then the property being added will not be changeable, and the action being added will not be executable. The behavior is similar to theREADONLYoption, but with an additional data-dependent condition.-
propertyExpression
-
-
CLASS propertyExpressionSpecifies a property whose value determines the CSS classes (separated by spaces) of the value element of the property being added. Similar to the
valueClassproperty in theDESIGNstatement.-
propertyExpression
-
-
BACKGROUND propertyExpressionSpecifying a property that determines the background color for the value cell of the property (action) being added. The property may have the
COLORtype (in this case, its value will be used) or any other type. In this case, if the value is not equalNULL, then either the default color stored in the global propertySystem.defaultBackgroundColor(set in settings) or yellow color (if the default color is not set) will be used.-
propertyExpression
-
-
FOREGROUND propertyExpressionSpecifying a property that determines the text color for the value cell of the property (action) being added. The property may have the
COLORtype (in this case, its value will be used) or any other type. In this case, if the value is not equal toNULL, then either the default text color stored in the global propertySystem.defaultForegroundColor(set in settings) or red color (if the default color is not set) will be used.-
propertyExpression
-
-
HEADER propertyExpressionSpecifying a property that determines the header for the column of the property (action) being added. The return value of this property will be used as the header. If the return value is
NULL, then the added property (action) will be automatically hidden.propertyExpression
-
FOOTER propertyExpressionSpecifying a property that determines the footer of the property (action) being added. Used only in the print view of the form.
-
propertyExpression
-
-
COLUMNS [groupid] (groupName1, ..., groupNameM)Specifies the upper object groups whose values will define a set of columns to display the added property (action). The
COLUMNSoption is often used with theHEADERoption which defines headers for these columns.-
groupidColumn group ID. String literal. If the
COLUMNSoption is specified for several properties (actions) being added with the same set of object groups, then by default the columns of the first property (action) will be added, followed by the columns of the second property (action), and so on. To group columns of different properties (actions) by values of the upper objects, you can set for them the same string ID of the group of columns. In this case, the columns for different properties (actions) will alternate. -
groupName1, ..., groupNameMList of the names of the upper object groups. Each name is defined by a simple ID.
-
-
DRAW groupObjectNameSpecifying the name of the object group on the form where the added property or action will be displayed in the table of the specified object group.
-
groupObjectNameName of an object group. Simple ID.
-
-
viewTypeSpecifying the view type of the property or action being added:
GRID— table columnTOOLBAR— toolbarPANEL— panelPOPUP— popup
If not specified, the corresponding option from the property options is used. If it is also not specified, then the default view type is used for the display group of this property or action.
-
customViewSpecifying a custom view of the value of the property being added. It can have one of the following forms:
-
CUSTOM renderFunction [CHANGE [editFunction]] -
CUSTOM CHANGE [editFunction]Specifying the JavaScript functions responsible for displaying (
renderFunction) and editing (editFunction) the property value. Each function is specified with a string literal containing its name. If no function is specified after theCHANGEkeyword, the default editing mechanism is used. -
SELECT selectTypeSpecifying that the property value should be displayed and edited as a selection from the list of possible values. The select element type
selectTypeis specified with a string literal (for example'dropdown','buttonGroup'). -
SELECT [AUTO]Specifying that the select element type is determined automatically. The
AUTOkeyword is optional and can be used for disambiguation. -
NOSELECTKeyword prohibiting the automatic selection of the view as a list of possible values.
-
-
OPTIONS propertyExpressionSpecifying a property whose value must be an object of the JSON class. The value is passed to the settings of the view of the value of the property being added.
-
propertyExpression
-
-
sessionScopeTypeThe session in which object operators (
NEW,EDIT,DELETE,NEWEDIT) must be executed. One of:NEWSESSION- a new sessionNESTEDSESSION- a nested sessionTHISSESSION- the current form session (default value). It makes sense to use it explicitly to cancel the modifier specified for the entire block.
-
APPLYModifier specifying that a change of the property being added (or execution of the action being added) is immediately applied (committed) to the database, instead of remaining in the current form session until it is applied explicitly. It can be combined with
NEWSESSION/NESTEDSESSION(the session scope determines the session in which the change is executed, after whichAPPLYcommits it) or used on its own. -
OPTIMISTICASYNCModifier for the action being added. Similar to the same option in the
ACTIONstatement. -
insertPositionSpecifying the insert position of the property (action) within the list of properties and actions on the form. Most often used together with the form extension mechanism. It can be specified in one of the following ways:
-
AFTER formPropertyName -
BEFORE formPropertyNameThe property (action) will be added to the form structure directly before (keyword
BEFORE) or after (keywordAFTER) the specified property (action) on the form.-
formPropertyName
-
-
FIRSTKeyword indicating that the property (action) will be added to the beginning of the list.
-
LASTKeyword indicating that the property (action) will be added to the end of the list. Unlike default addition, properties (actions) inserted using
LASTwill always be positioned after all properties (actions) added in the order of declaration. -
DEFAULTKeyword indicating that the property (action) is added in the order of declaration. This is the default value.
-
-
ORDER [USER | FIXED] [DESC]Specifies the ordering option for the added property. Similar to specifying the property in the order block.
-
USERThe property is added as a user order. This is the default behavior.
-
FIXEDThe property is added as a fixed order.
-
DESCUses descending order. If not specified, ascending order is used.
-
-
FILTER [USER | FIXED]Specifies the filtering option for the added property. Similar to specifying the property in the fixed filters block.
-
USERThe property is added as a user filter. This is the default behavior.
-
FIXEDThe property is added as a fixed filter.
-
-
QUICKFILTER formPropertyNameSpecifying the property to be used in default handlers for quick filtering.
-
formPropertyName
-
-
PIVOT calcTypeSpecifying the aggregation function that will be used for the values of the property being added when grouping rows (including the pivot table view type).
calcTypeis specified with one of the keywordsSUM,MAX,MIN. -
PIVOT LAST [DESC] (propertyExpression1, ..., propertyExpressionZ)Specifying that when grouping rows, the value of the property being added is taken from the row that is the last in the order of the values of the listed expressions (
DESC- in reverse order). -
COLUMN,ROW,MEASUREKeywords specifying the initial placement of the property being added in the pivot table view type: in columns (
COLUMN), rows (ROW), or measures (MEASURE). The per-element equivalent of theCOLUMNS,ROWSandMEASURESlists of the pivot block. -
ON eventType actionId(param1, ..., paramZ) | { actionOperator }Specifying the action that will be executed when the specified form event occurs.
-
eventTypeType of form event. It is specified by one of the following keywords:
-
CHANGE— the user tries to change the value of the property being added (call the added action). -
CHANGE BEFORE/CHANGE AFTER— occurs directly before (BEFORE) or after (AFTER) the value of the property being added is changed. -
CHANGEWYS— the user tries to change the displayed value of the property. It is triggered when the user inserts a text into the added property (by pressing Ctrl + V or similarly). -
GROUPCHANGE— the user tries to change the property value for all objects in the table (group change). -
EDIT— editing of the object passed to the property as input. -
KEYPRESS key— the user presses thekeykey, specified with a string literal. -
CONTEXTMENU [caption]is the event type which adds a menu item executing the specified action to the context menu of the property (action) on the form. You can also specify the caption for this menu item (as string literal). If it is not specified, then, by default, it will be the same as the action caption.-
captionCaption of the item in the context menu. String literal. If the caption is not specified explicitly, then it will be the same as the caption of the action called upon the event.
-
-
-
actionId -
param1, ..., paramZList of action parameters. Each parameter is specified with the object name on the form. The object name, in turn, is specified with a simple ID.
-
actionOperator
-
-
EVENTID eventIdSpecifying the event ID for the property (action) being added. Similar to the same option in the property options.
-
eventId
-
-
ATTRKeyword. Used only in the hierarchical view. Indicates that:
- When importing from XML, the data is imported from the tag attributes instead of the child tag.
- When exporting to XML, the data is exported to the tag attributes instead of the child tag.
-
EXTID extIDSpecifying the name to be used for export/import operations of this property. Used only in the structured view.
-
extIdString literal.
-
-
NOEXTIDKeyword excluding the property from export/import in the structured view.
-
EXTNULLKeyword. Used only in the hierarchical view. Indicates that when exporting to XML / JSON, NULL value will not be skipped, will be exported:
- to JSON as 'null'.
- to XML as empty value.
-
IN propertyGroupSpecifying a property/action group which the property (action) on the form belongs to. If this option is not specified, then the property group of the property itself will be used as the property (action) group on the form.
-
propertyGroupThe property group name. Composite ID.
-
-
imageSettingIcon settings for the property (action) on the form. This option allows you to configure the icon manually. It can have one of the following forms:
-
IMAGE imageLiteralManual icon specification for the property (action) on the form.
-
imageLiteralString literal whose value defines the icon.
-
-
IMAGE [AUTO]Indicates that the automatic assignment mode will be used. The
AUTOkeyword is optional and can be used for disambiguation. -
IMAGE propertyExpressionSpecifying a property whose value defines the icon. Allows setting the icon dynamically, depending on the data.
-
NOIMAGEKeyword indicating that the property (action) should have no icon on the form.
-
-
STICKY|NOSTICKYKeywords controlling whether the property (action) is pinned in the table. Similar to the same option in the property options.
-
syncTypeDefines whether the action is executed synchronously (
WAIT) or asynchronously (NOWAIT). If not specified, the corresponding option from the property options is used. -
HINTNOUPDATEKeyword. Marks that the cached values of the property being added should not be updated on changes in the session of this form. Similar to the
HINTNOUPDATEblock of theFORMstatement. -
HINTTABLEKeyword. Marks that the changes of the property being added should be materialized into a temporary table when the form reads its data. Similar to the
HINTTABLEblock of theFORMstatement.
Examples
CLASS Order;
date = DATA DATE (Order);
time = DATA TIME (Order);
number = DATA INTEGER (Order);
series = DATA BPSTRING[2] (Order);
note = DATA ISTRING[255] (Order);
CLASS OrderDetail;
order = DATA Order (OrderDetail) NONULL DELETE;
date(OrderDetail d) = date(order(d));
index (OrderDetail d) = PARTITION SUM 1 ORDER d BY order(d) CHARWIDTH 4;
sku = DATA Sku (OrderDetail);
nameSku (OrderDetail d) = name(sku(d));
quantity = DATA NUMERIC[10,2] (OrderDetail);
price = DATA NUMERIC[10,2] (OrderDetail);
sum = DATA NUMERIC[12,2] (OrderDetail);
sum (Order o) = GROUP SUM sum(OrderDetail d) BY order(d);
quantity (Order o, Sku s) = GROUP SUM quantity(OrderDetail d) BY order(d), sku(d);
lastDetail (Order o, Sku s) = GROUP MAX OrderDetail d BY order(d), sku(d);
changeQuantity (Order o, Sku s) {
INPUT n = NUMERIC[10,2] DO {
IF lastDetail(o, s) THEN {
IF n THEN
quantity(OrderDetail d) <- n WHERE d == lastDetail(o, s);
ELSE
DELETE OrderDetail d WHERE d == lastDetail(o, s);
} ELSE IF n THEN {
NEW d = OrderDetail {
order(d) <- o;
sku(d) <- s;
quantity(d) <- n;
}
}
}
}
stopOrder = DATA BOOLEAN (Sku);
onStock = DATA NUMERIC[10,2] (Sku);
ordered = DATA NUMERIC[10,2] (Sku);
CLASS Customer;
name = DATA ISTRING[100] (Customer);
FORM customers
OBJECTS c = Customer
PROPERTIES(c) READONLY name
LIST Customer OBJECT c
;
customer = DATA Customer (Order);
nameCustomer (Order o) = name(customer(o));
customer(OrderDetail d) = customer(order(d));
CLASS Region;
name = DATA STRING[100] (Region);
region = DATA Region (Customer);
// declaring the orders form
FORM order 'Order'
OBJECTS o = Order PANEL // adding an order object to the form
PROPERTIES VALUE(o), // adding the order ID in the database
// adding properties date/time of order, series/order number
date(o), time(o), series(o), number(o),
// adding the name of the customer, which by default will be available for editing
// here, when the user tries to edit it, a dialog will be called for the customer choice -
// a form for which the LIST customer parameter is set
nameCustomer(o),
note(o), // adding a note
// adding the order amount without the possibility of editing, since it is automatically
// calculated based on the sum of rows
sum(o) READONLY
OBJECTS d = OrderDetail // adding the order line object
PROPERTIES(d) // all properties in this block will have an order line input
index READONLY, // adding the ordinal line number and making it impossible to edit
nameSku, // adding a name
quantity, price, sum, // adding quantity, price, amount
NEW, // adding the predefined NEW action that adds a new order line
DELETE // adding an action that will delete the order line
FILTERS order(d) == o // indicating that only lines related to this order should be shown
// adding a sku object to which the totals for each sku in the order will be written
OBJECTS s = Sku
// adding a name, while making a note that it cannot be edited on this form
PROPERTIES(s) name READONLY
// adding a property that will display the ordered quantity by sku in this order
PROPERTIES quantity(o, s)
// by default, even though the property is not marked READONLY and nothing will happen when the user
// tries to change it, since quantity is an aggregated property. In this case, a note is made that
// when the user tries to change, the changeQuantity action will be called. An algorithm is written
// in this property that will create/delete order lines or change the quantity in them
ON CHANGE changeQuantity(o, s)
// making the property unavailable for editing, if the order is prohibited for this sku
READONLYIF stopOrder(s)
// in addition, in this case, this cell is highlighted with custom background so that the user
// can see such positions in advance
BACKGROUND stopOrder(s)
EDIT Order OBJECT o // marking the form as a form for editing orders
;
EXTEND FORM order // expanding the form with the Mixin concept
// adding the property of the current balance to the form before the quantity in the order
PROPERTIES onStock(s) BEFORE quantity(d),
// adding to the form the quantity of already ordered products within all orders
ordered(s) BEFORE quantity(d)
;
FORM orders 'Orders'
OBJECTS o = Order
// all properties in this block are unavailable for editing
PROPERTIES(o) READONLY VALUE, date, number
// adding predefined NEW and EDIT actions that will call the order form to add orders
PROPERTIES(o) NEWSESSION NEW, EDIT, DELETE
;
// creating a "report" in which orders for a certain interval will be visible in the context of customers
// in a particular region
FORM orderReport 'Sales by warehouse'
// declaring a group of objects, consisting of 2 objects of the Date class with the appropriate captions,
// which will always be displayed as a panel
OBJECTS interval = (dateFrom 'Date (from)' = DATE, dateTo 'Date (to)' = DATE) PANEL
// adding to the form the properties of the date objects values, with which the user can select dates
// in addition, assigning to these properties on the form names dateFrom and dateTo, respectively
PROPERTIES dateFrom = VALUE(dateFrom), dateTo = VALUE(dateTo)
OBJECTS r = Region PANEL // adding a region object, by which customers will be filtered
// adding the property region name, at the same time marking that when editing it, the dialog for choosing
// a region should be called, the selected value of which will be used as the current value
PROPERTIES(r) name SELECTOR
// adding the customers object, specifically not adding a single property so that it is "invisible",
// but it is needed in order to display customers in columns
OBJECTS c = Customer
FILTERS region(c) == r // setting a filter so that customers are only from this region
// adding a sku object, in the table of which basic information will be displayed
OBJECTS s = Sku
// adding the sku name and making it READONLY, otherwise the user will be able to change the product names
// directly in the report
PROPERTIES(s) name READONLY
// adding a property in which the quantity of ordered sku by customers for a certain date interval is calculated
PROPERTIES =
[GROUP SUM quantity(OrderDetail d) IF date(d) >= dateFrom AND date(d) <= dateTo BY sku(d), customer(d)](s, c)
COLUMNS (c) // marking that customers should be displayed in columns, with the same number of columns
// as there will be rows in the customer object, taking into account filters, and they will be
// displayed in the same order
HEADER name(c) // setting that the name of the customer will be used as the column heading
;