Smart Edit Forms
Basics
Smart edit forms use expressions to specify conditions for individual fields or whole forms.
Conditions
Some of important cases when conditions can be used are as follows:
- Conditions can be used for validating values in fields and SubRow cells
- Conditions can be used to define when a field is read-only
- Conditions can be used to determine whether to display or hide specific parameter values
A condition is an xml element which can include the following attributes:
- Test – Mandatory. Contains a constraint expression evaluated to a Boolean value.
- Error – Mandatory. Includes a text string shown when the Test condition is not satisfied.
- newOnly - Optional. The valid values are:
- "always". Default value if newOnly is missing. The Test condition is always checked.
- "main". The Test condition is checked only when the main object is new.
- "subrow". Can be used only for the SubRow control. A condition with this value is only checked for rows added in the current object editing session.
Here is a simple example of a condition that ensures that end date follows start date:
<condition test="[STARTDATE]<=[ENDDATE]" error="Start date should be before end date"/>
Edit Form XML Conditions
The XML conditions property of the whole form contains a set of conditions which must be satisfied before the form can be saved.
Please note the following:
- The SubRow control has its own XML conditions property.
- The edit form wizard does not use the XML conditions property of its main form.
Example:
<conditions>
<condition test="[STARTDATE]<=[ENDDATE]"
error="Start date should be before end date"/>
<condition test="([SALESPHASE]<>2 and [SALESPHASE]<>3 and [SALESPHASE]<>6) or ([SALES]+[SALES2]+[SALES3]+[SALES4]>0)" error="Please fill in the value of sales case"/>
<condition test="[SALESPHASE]<>3 OR [OFFERDATE]>=[STARTDATE]" error="Offer date should be after start date"/>
</conditions>
Field/Control Properties
Default Value
Use an expression in the DefaultValue property to define the default value which is automatically entered when a new object/sub row created.
Enable Condition
The EnableCondition property is specified by an expression evaluated to a Boolean value. If True, it enables the field for editing.
Example:
The following enable condition in a sales case form enables the offer date field for three phases only (e.g. 'Solution', 'Offer' and 'Contract'):
[SALESPHASE]=2 or [SALESPHASE]=3 or [SALESPHASE]=6
Visible Condition
The VisibleCondition property may contain an empty string or an expression which evaluates to True or False. If the expression evaluates to True or the expression is not specified then the control visibility is the same as object field visibility (an object field can be marked as hidden by using HIDDEN field of VY_OBJECT_FIELD table or VY_TABLE_HIDDENFIELD table). If expression evaluates to false then the control is hidden.
Calculation Expression
The Calculation Expression property can be used to combine several object fields and perform arithmetic or string operations on them. It is possible to combine fields not only from the current opened edit form but, in case of a wizard, from previously visited forms.
Example 1:
Used for Offer Date field in a sales case form:
isnull([offerDate], iif([salesphase]=3, [$now], [offerDate]))
Here if offerDate is null then salesphase is checked and the current date is returned if salesphase=3 ('Offer').
Note: Read-only field saved only if it has calculation expression.
Example 2:
You have a parameter field and you want to fix one parameter value so that the user sees it but can't change. If you only set the default value and define the field as read-only, then the default value will not be saved to the database when new object created. You have to set the default value and the calculation expression to the same value and set the field as read-only.
Example 3:
Link fields can be used when combining fields into other fields. Here the Name field is built from the Company name + Subject+ start date year:
Trim(substring(isnull([302->VY_COMPANY.NAME], ''),1,20)) + ' - ' + Trim(substring([subject],1,20)) + ' - ' + GetYear([startdate])

Figure 13. Object Manager: Combining Name field from Company name, Subject and StartDate

Figure 14. Vintage: Combining Name field from Company name, Subject and StartDate
Parameter Conditions
Parameter Conditions property available for parameter field controls. It is possible to add a parameter enable condition for a parameter value. If the condition is not satisfied then the parameter value is removed.
Example: Used for Sales Phase field in a sales case form:
<parameterConditions>
<parameterCondition parameterValue="1" test="[old.ID]=0 or ([old.salesphase]<>6 and [old.salesphase]<>5)"/>
<!-- phase 1 (Customer Needs) enabled only if new object ([old.ID]=0) or phase not 6 (Contract) and not 5 (Lost) -->
<parameterCondition parameterValue="2" test="[old.ID]=0 or ([old.salesphase]<>6 and [old.salesphase]<>5)"/>
<parameterCondition parameterValue="3" test="[old.ID]=0 or ([old.salesphase]<>6 and [old.salesphase]<>5)"/>
<parameterCondition parameterValue="4" test="[old.ID]<>0"/>
<!-- phase 4 (Fall through) enabled only if object not new ([old.ID]<>0) -->
<parameterCondition parameterValue="5" test="[old.ID]<>0"/>
<parameterCondition parameterValue="10" test="[old.ID]=0 or ([old.salesphase]<>6 and [old.salesphase]<>5)"/>
</parameterConditions>
SubRows (table view) control
SubRows (table view) control can be added to a form. SubRow lists objects connected to the main object with chosen connection types. Objects can be created, deleted and edited right in the table view.
Creating SubRow Control
After you placed a subrow control on the from you first need to select ConnectionType for it. That will determine the type of objects shown in the SubRow.
Columns Editor and Columns Properites
Use the Coulmns property to define which columns shown in the SubRow control. Click the ellipsis button '…' in the Columns property and the following Columns Editor will appear:

- CalculationExpression - can be used to calculate cell value
- Conditions – lists conditions from the contaner SubRows control related to this column..
- The DefaultValue property is the same as for all other fieldcontrols
- EditControl can take the following values: TextBox, ComboBox, CheckBox. If EditControl is set to CheckBox then the CheckedValue and UncheckedValue properties become available.
- EditMode can be: Read, Edit, EditOnce
- EnableCondition – an expression which can be used to set cell to editable or read-only state. If EnableCondition is given then EditMode is ignored when defining if the cell should be read-only.
- Field – object's field. Starting from Vine 5.0 Field is optional. If it is not specified then EditMode must be set to 'Read' and 'calculationExpression' specified. The value of the calculationExpression will be only shown to the user and not saved to the database.
- Format for DATE fields can be standard d (i.e. short date) and g (short date/time) formats or custom format strings using the usual windows notation, e.g. dd-MM-yyyy.
- Format for REAL fields can be 0, 0.0 or 0.00 which define fixed number of digits formats and 0.#, 0.## which define floating number of digits formats. If no format entered then 0.00 is used as default.
- ParemeterConditions – can be used for parameter columns. Similar to the ParameterConditions property of the ParameterField control (see above).
- Sort – sets the sorting order Asc/Dexc /None
- Width – sets the column width in pixels
You can also directly edit the column layout and their properties using the XMLColumns property.
XML Conditions property
The XML conditions property of a SubRow control applies only to the SubRow control and can use expressions and attribute values applicable for SubRows.
Validation notes:
If condition contains at least one [fieldName] identifier then it relates to individual rows (e.g. [startDate]<[endDate]) else it relates to entire grid (e.g. Sum([percentage])=100).
First all conditions for individual rows are checked for the newly created or modified row. If row doesn’t satisfy any condition then validation is stopped, cells specified in condition are selected and error is displayed. If all conditions are satisfied then next row is checked and so on.
Next conditions for entire grid are checked. If grid doesn’t satisfy any condition then validation is stopped, columns specified in condition (by using aggregate values) are selected and error is displayed.
Edit Form Wizard
Edit form wizards are created by placing the Wizard control on an edit form in Object Manager.
There are a few things, however, you should be aware of when creating wizards:
- The wizard takes up the whole of the underlying edit form. To resize the wizard you need to resize the form and to resize the form you have to select the Edit Form node in the top right control tree view.
- The XML Conditions property of the whole form is not used. While each wizard page can have its own set of conditions.
- The header and footer areas are automatically added by Vintage. The description property of a wizard page is located in the wizard header and the Back/Next buttons are located in the footer.
Wizard Pages
To edit pages properties you need to select the Wizard and click the ellipsis button for the TabPages property.

The Pages Editor will appear where you can:
- Set the page name. This is internal name to refer to a needed page in the wizard.
- Set the page title which is shown in Vintage.
- Set the page description shown in Vintage.
- Specy which page will be next. NextPageNameExpression evaluates to the name of the page opened when user clickes Next. If it evaluates to 'SAVE' then the Next button is substituted with the Save button.
- To add conditions for the page click the ellipsis butoon in Conditions:

The Next button is not enabled until all page conditions are satisfied.
Hot keys for fields
You can define an alt hot key for a field by preceding the hot key character in the field’s title with the ‘&’ sign:

In Vintage, you can press ALT+hotkey to jump directly to the field.
Collection Link Fields
Collection Link Fields can be used to allow the user to manage an object’s collection connections right from the edit from.
Example
If you have collections which are members of parent collections such as, “Customer Location” and “Mailing lists” then you might use Collection Link Fields to prompt the user to connect an edited person to the member collections, as shown below:
|
|
When the person above is saved it gets connected to the “Europe” location collection as well as to the “Designers” and “IT Experts” mail profile collections.
The “Location” collections are taken from the “Customer Location” collection (this is set by a system setting) and shown in a combo list because the “Customer Location” is an exclusive collection and the user can’t be allowed to select more than one member collection.
The “Mail profile” collections are taken from the “Mailing Lists” collection (set by a system setting) and shown in a list with checkboxes because the user can select any number of member collection.
The names of the system settings which specify the parent collection for each collection link field are taken from the object edit form and must be provided when creating those in Object Manager.
For example, a system setting named “PersonLocationCollection” can store the parent collection for the “Location” list and a system setting, “PersonMailProfileCollection” can store the parent collection for the “Mail Profile” collection list. A system setting must be provided when creating a collection link field in Object Manager as shown below.
Creating in Object Manager
Collection Link Fields can be created in Vine Object Manager as follows:
Put a field of the Description type on the object edit form.
Specify which system setting will hold the ID of the parent collection for the field by putting a string of the “$COLLECTIONLIST:NameOfSystemSetting” format in the Field setting.
Set other settings of the Description field as needed:

In addition to the system setting(s) specified on the edit form, a system setting such as VX_COLLECTIONTOOL_VY_PERSON_CTYPE (where “PERSON” can be replaced with other object type) has to be created in the Vine database to specify which connection type should be used when connecting a person to the user chosen collections.
Here is how the system settings can be set for the example above (using the Web Administrator’s Console):

Button Commands
When designing an object’s edit form using Vine Object Manager, you can add action buttons on it. And use the XMLCommand property and the buttonCommand tag to set a specific action for the command:

Currently the following commands are supported:
- launchCrystalReport - opens a crystal report
- launchWebPlugin - opens a web plug-in
- launchNETPlugin – starts .Net plugin. (Supported in Vintage only.)
- SendEmail – opens an email application and loads email address, subject, and body. (Supported in Vintage only.)
- CreateObject – creates a new object and opens its edit form. (Supported in Vintage only.)
The panel supports the following attributes:
- closeAfterCommand. The edit form is closed after the button pressed if closeAfterCommand = "yes". The form stays open if closeAfterCommand = "no"
Launch Crystal Report
<buttonCommand closeAfterCommand = "yes">
<launchCrystalReport fileName="Sample Report10.rpt"/>
</buttonCommand>
LaunchWebPlugin
<buttonCommand closeAfterCommand = "yes">
<launchWebPlugin pluginName="google Person"/>
</buttonCommand>
LaunchNETPlugin
Launches specified .NET plug-in (with implemented IVintagePlugin interface) from the database.
The current object is passed using VintageObjects collection.
<buttonCommand closeAfterCommand = "no">
<launchNETPlugin className="TestNETPlugin.TestNETControl"/>
</buttonCommand>
SendEmail
The command opens an email application and loads provided email address, email subject and body:
<buttonCommand closeAfterCommand = "no">
<sendEmail to="[326->VY_PERSON.EMAIL]">
<title>'RE:'+[NAME]+' #'+[CASEID]</title>
<body>
<p></p>
<p> </p>
<p>Best Regards,</p>
<p>Customer Service</p>
</body>
</sendEmail>
</buttonCommand>
CreateObject
Creates an object, saves it and opens its edit form:
- Setting object fields
<field name="EVENTTYPE" value="'-3'" />
- Current object fields can be used to set fields of the new object.
<field name="NAME" value="'Email:' + [NAME]" />
- A connection between the current object and the new one can be created
<addConnection connectionType="329" createdObjectIsTarget="no" />
- The new object can be connected to objects connected to the current objects (copyConnection)
<copyConnection otherType="VY_COMPANY" fromConnectionType="327"
targetConnectionType="16" />
Example: ‘Add Event’ button for service request which creates a new event
<buttonCommand closeAfterCommand = "no">
<createObject type="VY_EVENT" editAfterCreation="yes" >
<field name="NAME" value="'Email:' + [NAME]" />
<field name="STARTDATE" value="[$now]" />
<field name="ENDDATE" value="[$now]" />
<field name="EVENTTYPE" value="'-3'" />
<field name="EVENTPHASE" value="'1'" />
<field name="REMINDTYPE" value="'0'" />
<field name="REPEATID" value="'0'" />
<field name="REPEATTYPE" value="'0'" />
<addConnection connectionType="329" createdObjectIsTarget="no" />
<copyConnection otherType="VY_COMPANY" fromConnectionType="327"
targetConnectionType="16" />
<copyConnection otherType="VY_PERSON" fromConnectionType="326"
targetConnectionType="3" />
</createObject>
</buttonCommand>


Comments
0 comments
Please sign in to leave a comment.