Select Expressions
The purpose of select expressions is to obtain or use information related to a
business object. The system attempts to produce output for each select clause input,
even if the object does not have a value for it. If this is the case, an empty field
is output.
- In a query or a visual, the select expression value is used to qualify the
search criteria (in a where clause) by comparing it with another (given) value.
- In a table, report, or form, the expression defines the information to present
in a column or field.
- In a
print
or expand
statement, the expression
defines the information to output about the object(s).
You can obtain information which includes not only attribute values and other
business object data, but also administrative object information, such as the
governing policy, vault, and so on. The key property of a select expression is that
it can access information related to an object.
In all cases, the expression is processed from the context of a starting object.
- In a query, the starting point is the business objects that meet other selection
criteria (vault, type, and so on).
- In a table, the starting point is the business object in each row.
The phrase starting point is used because the select mechanism actually uses the same
concept of navigation from one object to another that makes the rest of the system
so flexible. Most information is actually represented internally by a small object
and not by a text string or numeric value as it appears to the user.
These internal objects are all linked in the same way business objects are connected
by relationships. The links can be navigated from one object to another. A period
(.) indicates a link in the select expression. The entire list of selectable fields
can be obtained via MQL.
If you type this MQL command:
print businessobject selectable;
|
The result is similar to:
name
description
revision
originated
modified
lattice.*
owner.*
grantor.*
grantee.*
granteeaccess
granteesignature
policy.*
type.*
attribute[].*
default.*
format[].*
current.*
state[].*
revisions[].*
previous.*
next.*
first.*
last.*
history
relationship[].*
to[].*
from[].*
exists
islockingenforced
vault.*
locked
locker.*
reserved
reservedby
reservedstart
reservedcomment
id
method
search*
|
The .*
notation indicates the item is an object and you can navigate
to other information from that object. Items without this notation are simple data
types (locked
, id
, method
, and so
on) and cannot be used for further navigation.
The square bracket notation (for example, attribute[].*
) indicates
that there can be many linked attribute objects and that a specific name can be
entered if it is known. By contrast, object notations without the square brackets
(for example, owner.*
), means there is only one Owner object linked
to the starting object.
If you expand the information available from the Owner object by typing:
print businessobject selectable owner;
|
these options are listed:
owner.name
owner.description
owner.property[].*
owner.hidden
owner.id
owner.mask.*
owner.admin.*
owner.email
owner.isaperson
owner.isagroup
owner.isarole
|
owner.name
indicates that you can find the name of the owner by
navigating to the Owner object and then to the name data (string, in this case) in
that object. Each successive expansion may reveal other objects that can yield more
information.
A business object can only have a single governing policy, so the square bracket
notation does not appear. If you expand the information available from the
policy.*
option by typing:
print businessobject selectable policy;
|
These options are listed:
policy.name
policy.description
policy.property[].*
policy.hidden
policy.id
policy.type[].*
policy.format[].*
policy.defaultformat.*
policy.state[].*
policy.revision
policy.store.*
policy.islockingenforced
|
If you expand the information further for the policy.state
option by
typing:
print businessobject selectable policy.state;
|
These options are listed:
policy.state.name
policy.state.publicaccess.*
policy.state.owneraccess.*
policy.state.notify
policy.state.route
policy.state.action
policy.state.check
policy.state.access[].*
policy.state.signature[].*
policy.state.revisionable
policy.state.versionable
policy.state.autopromote
policy.state.checkouthistory
|
You use the same process for expanding selectable fields as the process of expanding
connected business objects in the Navigator browser. It involves following links
from one item to another.
Programs should be explicit about the selectables desired and their output order.
Dassault Systemes does not guarantee output will remain in the same order.
latest and islast Selectables
The latest
and islast
selectables are similar but
could produce different results. The values for these selectables are not stored,
but calculated at the time of the query.
latest
operates on minor revisions only. A business object is the
"latest" only if it is the last revision in the minor-revision family in the
specified state.
islast
is true for a business object if the revision is the last of
its minor family. The query retrieves all objects with the same majorid value and
sorts them based on minor order, with the last revision being true for
islast
.
Scenario for Selectables
This example shows a business object, Assembly 90000 A, with the following
properties:
Assembly 900000 A
policy = Production
current = Released
description = Bed Frame
cost = 1000
weight = 100
|
Example
Suppose you want to use the information about the policy. The table below shows how
this information is obtained with the MQL print command and also how it could be used in finds, tables, and so on.
|
MQL print Command |
Find or Visuals Where Clause |
Table, Report, Form Field |
Select
Expression
|
print bus Assembly 90000 A select policy;
|
policy = production
|
policy
|
Result
|
MQL returns:
policy = Production
|
Assembly 90000 A is found or the visuals are applied to it.
|
If Assembly 90000 A is in the table/report/form,
Production is output in that
column/field.
|
In the where clause, a space must be included before and after all operators.
Example:
This example shows how to use the attribute "Cost" in Assembly 90000 A. The table
below shows how this information is obtained with the MQL print command and also how it could be used in finds, tables, and so on.
|
MQL print Command |
Find or Visuals Where Clause |
Table, Report, Form Field |
Select
Expression
|
print bus Assembly 90000 A select
attribute[cost];
|
type == Assembly && attribute[cost] == 1000
(or perhaps, attribute[cost] < 2500,
and so on.)
|
attribute[cost]
|
Result
|
MQL returns:
attribute[cost] = 1000
|
Assembly 90000 A is found or the visuals are applied.
|
If Assembly 90000 A is in the table, report, or form,
1000 is output in that column/field.
|