XML Data Types
Following data types are used in predefined panels to specify sets of objects and calculate summary values for them.
ConnectedObjectSetType
ConnectedObjectSet (an element of the ConnectedObjectSetType type) is used to build a set of objects using either of these commands:
- ConnectedObjectQuery – returns objects connected to the parent object(s) with the given connectionType and reverseLink attributes. Nested ConnectedObjectQuery can be used. So it is possible to obtain objects connected to objects connected to the parent object and so on.
- ObjectQuery – returns a set of objects by setting the objectType attribute. ConnectedObjectQuery commands can be used after ObjectQuery. The first ConnectedObjectQuery command will then use the set returned by ObjectQuery as a set of parent objects.
To filter the returned set an optional filter (limit element) can be used.
The Parent object can be specified implicitly or explicitly by using the following two attributes together:
- settingName – name of system setting which contains ID of “parent” object or “[$CurrentUser]” string which is treated as ID of current Vintage user.
- objectType – type of “parent” object. If “settingName” specifies “[$CurrentUser]” then “objectType” attribute is ignored.
Implicit parent definition:
- Today page – current user
- Summary View - object displayed
In XML tools:
- Chart – account for which summary of sales shown
- Tableview - row from table
Basically, connectedObjectSet is processed the following way:
A set of objects defined by ObjectQuery OR ConnectedObjectQuery and satisfy optional filters is retrieved. If there is only one objectQuery/connectedObjectQuery element then processing is stopped.
If there is one more connectedObjectQuery then objects connected to each of the objects retrieved on first step are selected (“connectionType” and “reverseLink” attributes and “limit” element of the second “connectedObjectQuery” element are applied) and results are united.
Example 1 (connectedObjectQuery):
In the following example, first all accounts the user responsible for are retrieved (con type 315) and then sales cases connected to these accounts are retrieved. The limit element further restricts the set by picking only sales cases in the Contract(-20) phase.
<connectedObjectSet>
<connectedObjectQuery connectionType="315" reverseLink="true"/>
<connectedObjectQuery connectionType="314" reverseLink="false">
<limit>
<sequence>
<filterValue column="salesphase" operator="=" operand="-20"/>
</sequence>
</limit>
</connectedObjectQuery>
</connectedObjectSet>
Example 2 (objectQuery):
For example (taken from Management-Sales Funnel), here all person objects filtered by id will be retrieved:
<connectedObjectSet>
<objectQuery objectType="VY_PERSON">
<limit>
<filterValue column="id" operator="=" operand="[parameter:PersonId]"/>
</limit>
</objectQuery>
ParameterSetType
ParameterSet elements of the ParameterSetType type specify subset of records of parameter table.
Example:
In the following example, parameterSet is used to define chart categories (against which values are distributed) by getting a subset of sales phases:
Subset of parameter table (ParameterSetType). Example: list of sales phases in “My Sales Cases” chart.
<panel plugin="Vineyard.Chart" autoSize="false" size="50" xsi:type="ChartPanelType">
<categories>
<parameterSet tableName="VY_SALESPHASE" parameterName="SalesPhaseID">
<limit>
<sequence>
<filterValue column="id" operator="!=" operand="-15"/>
<filterValue column="id" operator="!=" operand="-10"/>
<filterValue column="id" operator="!=" operand="-20"/>
</sequence>
</limit>
</parameterSet>
</categories>
ComplexExpressionType
Element of this type specifies expression which depends on one or more sets of connected objects (ConnectedObjectSetType). Functions such as Sum and RowCount can be used in such expressions to retrieve summary values. If there are several objects sets then they must be assigned names (“name” attribute of “connectedObjectSet” elements). These names must be specified in calls of Sum2, Avg2, Max2, Min2 and RowCount2 functions. Example is expression used in “My Accounts” chart. It uses sets of sales case objects and budget objects:
<value expression="(Sum([sales], 'SalesCases') + Sum([sales2], 'SalesCases') + Sum([sales3], 'SalesCases') + 36 * Sum([sales4], 'SalesCases'))/Sum([sales], 'Budgets')">
<connectedObjectSet name="SalesCases">
<!--...-->
</connectedObjectSet>
<connectedObjectSet name="Budgets">
<!--...-->
</connectedObjectSet>
</value>
Filtering Elements
To filter the returned set an optional filter (limit element) can be used which can include the filterValue and filterConnection elements.
filterValue element
This element selects all objects which have a specific value in the specified field. The following methods can be used to specify a value to compare with:
- Constant – number, string or date
- Macro – such as ThisYear, PrevYear, Now and etc.
- Expression – expression which does not depend on any objects, e.g. operand="[expression:MakeDate(GetYear([$now]), 3, 1)]"
- Parameter – value provided by component which uses query, e.g. operand="[parameter:PeriodEnd]"
Example 1:
<parameterSet tableName="VY_SALESPHASE" parameterName="SalesPhaseID">
<limit>
<sequence>
<filterValue column="id" operator="!=" operand="-15"/>
<filterValue column="id" operator="!=" operand="-10"/>
<filterValue column="id" operator="!=" operand="-20"/>
</sequence>
</limit>
filterConnection element
This element selects all objects which are connected to the specified object(s) using the connection type specified by the connectionType attribute. Object is specified by the settingName attribute (If there is no settingName then all objects having a connection of the given type will be returned).
settingName contains the name of a system setting with object ID or “[$CurrentUser]” string which is treated as ID of currently logged-on Vintage user. reverseLink attribute defines the connection direction, i.e. the ID of the specified object is compared with FROMOBJECTID of connection object when it is false or with TARGETOBJECTID otherwise.
<filterConnection connectionType="1040" reverseLink="true" settingName="VY_PERSON_ID"/>
Example (used in Today_-2.xml):
<connectedObjectSet>
<objectQuery objectType="VY_EVENT">
<limit>
<sequence>
<filterValue column="reported" operator="=" operand="-10"/>
<filterValue column="eventtype" operator="=" operand="-11"/>
<filterConnection connectionType="4" reverseLink="true"
settingName="[$CurrentUser]"/>
</sequence>
</limit>
</objectQuery>
</connectedObjectSet>
Comments
0 comments
Please sign in to leave a comment.