SyntaxThese commands enable you to view all the files and information used to define the 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.
When this command is processed, MQL displays all information that makes up the named business object’s definition. This information appears in alphabetical order according to names of the object’s fields. For example, you could obtain the definition for the “Shipping Form” “Lyon’s Order” A business object by entering:
The Print Businessobject command uses four optional Print command clauses: The optional forms of the Print Businessobject command let you specify the information you want to retrieve from a business object. This subset is created by identifying the desired fields of the business object. The field contents can be prepared for formatting and stored in an external file. But which fields can you print and how do you specify them? The Print Businessobject Selectable command addresses these questions. This command lets you view a listing of field choices and specify those choices. Reviewing the List of Field NamesThe first step is to examine the general list of field names:
The Selectable clause is similar to using the ellipsis button in the graphical applications—it provides a list from which to choose. When the command above is processed, MQL lists all selectable fields with their associated values. This command might produce a listing such as:
Some of the fields are followed by square brackets and/or a " .* ". The asterisk denotes that the field can be further expanded, separating the subfields with a period. If only one value is associated, the name appears without an asterisk. For example, the Name and Description fields each have only a single value that can be printed. On the other hand, a field such as type has other items that can be selected. If you expand the Type field, you might find fields such as type.name , type.description , and type.policy . This means that from any business object, you could select a description of its type and find out other valid policies for it:
The above might output something like this:
All items that can be further expanded have a default subfield that is used when that field is specified alone. For example, selecting type is the same as selecting type.name, because the default for types is the type name. For more information, see the Appendix: Selectables. The use of square brackets in the above selectable list indicates one of two things:
For more information, see Expand Business Object. Once you have identified names of the fields that can be printed, you can select them. The Select Businessobject statement tags the items to be shown in a subsequent Print statement. This is like creating a form in Business Administrator where you decide what collection of information to display. The Print statement is then comparable to displaying the form in a web app.
For example:
This select command is added as a clause to the Print Businessobject command:
This yields:
The fields appear in the order they were specified in the Select clause. Sortattributes ClauseWhen printing business objects, the Sortattributes clause causes the command to list attributes in the same order as in 3DSpace. Connection Selectables
The
For example, the following commands create a set of objects with relationships that connect objects to objects, objects to relationships, relationships to objects, and relationships to relationships. They then execute print/query commands with the corresponding selectables. # # Creates this structure: # # A1 ------rx------> A2 ------rx------> A3 ------rx------> A4 # \ | \ # \ | \ # o2r r2r r2o # \ | \ # \ | \ # B1 ------rx------> B2 set context user creator; add vault unit1; add attribute string-u type string; add attribute rstring-u type string; add type tx attribute string-u; add policy px type tx state one state final; add rel rx from type tx to type tx attribute rstring-u; add rel r2o from rel rx to type tx attribute rstring-u; add rel o2r from type tx to rel rx attribute rstring-u; add rel r2r from rel rx to rel rx attribute rstring-u; add bus tx A1 0 policy px vault unit1 string-u A1-attr; add bus tx A2 0 policy px vault unit1 string-u A2-attr; add bus tx A3 0 policy px vault unit1 string-u A3-attr; add bus tx A4 0 policy px vault unit1 string-u A4-attr; add bus tx B1 0 policy px vault unit1 string-u B1-attr; add bus tx B2 0 policy px vault unit1 string-u B2-attr; connect bus tx A1 0 rel rx to tx A2 0 rstring-u A1-A2; connect bus tx A2 0 rel rx to tx A3 0 rstring-u A2-A3; connect bus tx A3 0 rel rx to tx A4 0 rstring-u A3-A4; connect bus tx B1 0 rel rx to tx B2 0 rstring-u B1-B2; add connection o2r from tx A1 0 torel bus tx B1 0 to tx B2 0 rel rx rstring-u A1-rel; add connection r2o fromrel bus tx A1 0 to tx A2 0 rel rx to tx B2 0 rstring-u rel-B2; add connection r2r fromrel bus tx A1 0 to tx A2 0 rel rx torel bus tx B1 0 to tx B2 0 rel rx rstring-u rel-rel; # Fromrel, torel show any relationships on the to/from end of "this" relationship. # Frommid, tomid show any relationships that have "this" relationship to relationships # allow subselects to get data on the rels they map to. print bus tx A1 0 select from.attribute.value from.torel from.torel.attribute.value from.torel.from.name from.torel.to.name; query connection type rx,r2o,o2r,r2r select fromrel fromrel.attribute[rstring-u] torel torel.attribute[rstring-u]; query connection type rx,r2o,o2r,r2r select frommid frommid.attribute[rstring-u] tomid tomid.attribute[rstring-u]; # Fromall, toall show both businessobjects and rels (with a B or R prefix) # They query connection type rx,r2o,o2r,r2r select fromall toall; # Cleanup del bus tx A1 0 ; del bus tx A2 0 ; del bus tx A3 0 ; del bus tx A4 0 ; del bus tx B1 0 ; del bus tx B2 0 ; del rel rx; del rel r2o; del rel o2r; del rel r2r; del policy px; del type tx; ########################################################################### # HF-105472V6R2012_ tcl; set rxId "" set o2rId "" set obj2Id "" set lIds [split [mql print bus tx A1 0 select id from.id from.to.id] \n] foreach sId $lIds { if {[string first "\[rx\].id" $sId] > 0} { set rxId [string trim [lindex [split $sId =] 1]] } if {[string first "o2r" $sId] > 0} { set o2rId [string trim [lindex [split $sId =] 1]] } if {[string first "\[rx\].to.id" $sId] > 0} { set obj2Id [string trim [lindex [split $sId =] 1]] } set r2oId [mql print bus tx B2 0 select to\[r2o\].id dump] } puts "rxId=$rxId\no2rId=$o2rId\nobj2Id=$obj2Id\nr2oId=$r2oId" # Bad command - changing TO from obj to rel mql start trans; mql mod connection $rxId torel $o2rId mql abort trans; # Bad command - changing TO from rel to obj mql start trans; mql mod connection $o2rId to $obj2Id mql abort trans; # Bad command - changing FROM from obj to rel mql start trans; mql mod connection $rxId fromrel $o2rId mql abort trans; # Bad command - changing FROM from rel to obj mql start trans; mql mod connection $r2oId from $obj2Id mql abort trans; # Cleanup del bus tx A1 0; del bus tx A2 0; del bus tx A3 0; del bus tx A4 0; del bus tx B1 0; del bus tx B2 0; del rel rx; del rel r2o; del rel o2r; del rel r2r; del type tx; ################################################################### # # GENERATE XML OUTPUT FROM EXPAND COMMAND # expand bus tx A1 0 xml from recurse to all select bus attribute.value select rel type attribute.value frommid.attribute.value frommid.to.type frommid.to.name frommid.to.revision frommid.torel frommid.torel.attribute.value frommid.torel.from.name frommid.torel.to.name output testExpand.xml; The output of the above commands is as follows: MQL<100>add type tx attribute string-u; MQL<101>add policy px type tx state one state final; MQL<102>add rel rx from type tx to type tx attribute rstring-u; MQL<103>add rel r2o from rel rx to type tx attribute rstring-u; MQL<104>add rel o2r from type tx to rel rx attribute rstring-u; MQL<105>add rel r2r from rel rx to rel rx attribute rstring-u; MQL<106>add bus tx A1 0 policy px vault unit1 string-u A1-attr; MQL<107>add bus tx A2 0 policy px vault unit1 string-u A2-attr; MQL<108>add bus tx A3 0 policy px vault unit1 string-u A3-attr; MQL<109>add bus tx A4 0 policy px vault unit1 string-u A4-attr; MQL<110>add bus tx B1 0 policy px vault unit1 string-u B1-attr; MQL<111>add bus tx B2 0 policy px vault unit1 string-u B2-attr; MQL<112>connect bus tx A1 0 rel rx to tx A2 0 rstring-u A1-A2; MQL<113>connect bus tx A2 0 rel rx to tx A3 0 rstring-u A2-A3; MQL<114>connect bus tx A3 0 rel rx to tx A4 0 rstring-u A3-A4; MQL<115>connect bus tx B1 0 rel rx to tx B2 0 rstring-u B1-B2; MQL<116>add connection o2r from tx A1 0 torel bus tx B1 0 to tx B2 0 rel rx rstring-u A1-rel; MQL<117>add connection r2o fromrel bus tx A1 0 to tx A2 0 rel rx to tx B2 0 rstring-u rel-B2; MQL<118>add connection r2r fromrel bus tx A1 0 to tx A2 0 rel rx torel bus tx B1 0 to tx B2 0 rel rx rstring-u rel-rel; MQL<119>print bus tx A1 0 select from.attribute.value from.torel from.torel.attribute.value from.torel.from.name from.torel.to.name; business object tx A1 0 from[o2r].attribute[rstring-u].value = A1-rel from[rx].attribute[rstring-u].value = A1-A2 from[o2r].torel = rx from[o2r].torel.attribute[rstring-u].value = B1-B2 from[o2r].torel.from.name = B1 from[o2r].torel.to.name = B2 MQL<120>query connection type rx,r2o,o2r,r2r select fromrel fromrel.attribute[rstring-u] torel torel.attribute[rstring-u]; relationship rx relationship rx relationship rx relationship rx relationship o2r torel = rx torel.attribute[rstring-u] = B1-B2 relationship r2o fromrel = rx fromrel.attribute[rstring-u] = A1-A2 relationship r2r fromrel = rx fromrel.attribute[rstring-u] = A1-A2 torel = rx torel.attribute[rstring-u] = B1-B2 MQL<121>query connection type rx,r2o,o2r,r2r select frommid frommid.attribute[rstring-u] tomid tomid.attribute[rstring-u]; relationship rx relationship rx relationship rx frommid = r2o frommid = r2r frommid[r2o].attribute[rstring-u] = rel-B2 frommid[r2r].attribute[rstring-u] = rel-rel relationship rx tomid = o2r tomid = r2r tomid[o2r].attribute[rstring-u] = A1-rel tomid[r2r].attribute[rstring-u] = rel-rel relationship o2r relationship r2o relatioship r2r MQL<122>query connection type rx,r2o,o2r,r2r select fromall fromall.attribute[rstring-u] toall toall.attribute[rstring-u]; relationship rx fromall = B2384.50535.15736.55350 toall = B2384.50535.15736.54777 relationship rx fromall = B2384.50535.15736.54777 toall = B2384.50535.15736.32988 relationship rx fromall = B2384.50535.15736.51305 toall = B2384.50535.15736.55350 relationship rx fromall = B2384.50535.15736.63113 toall = B2384.50535.15736.6841 relationship o2r fromall = B2384.50535.15736.51305 toall = R2384.50535.15736.45609 relationship r2o fromall = R2384.50535.15736.51178 toall = B2384.50535.15736.6841 relationship r2r fromall = R2384.50535.15736.51178 toall = R2384.50535.15736.45609 Revisions Selectable
The
Method and Program SelectablesThe select keywords method and program can be used wherever select keywords for business objects can be used. They can be used in both print bus and in expressions evaluated against business objects. The syntax is:
Zero or more arguments can be included as indicated. The total number of characters in brackets is limited to 128.
The
The select clause returns a string whose value is specified by the program. The program specifies it by placing the string in the GLOBAL RPE variable whose name equals the program name. This is consistent with the use of a program to load a single valued text widget, except for having to use
As a select clause, this capability can be used in any of the following ways:
Execute Selectable
You can use the select keyword
And then in the program X have:
The keyword cestamp Selectable
CEStamp (Concurrent Engineering Stamp) implements optimistic offline lock, a method to prevent conflict between concurrent transactions by detecting a conflict and rolling back the transaction. When you have the
.generic subselectThe kernel provides a number of APIs that output fields for dates, times, and real numbers according to global environment variables ( MX_NORMAL_DATETIME_FORMAT, MX_DECIMAL_SYMBOL, and so on) set by an Administrator. Since there are many formats possible to output these fields, a generic format can now be used to ensure consistent date, time, and real number format regardless of the global settings. To use the generic format, add the ‘generic’ subselect or suffix to a selectable, for example, attribute[Cost].generic or modified.generic. The generic format for dates and times corresponds to JavaSimpleDateTimeFormat specified by the following date and time pattern: yyyy/MM/ dd'@'HH:mm:ss:z. For real numbers, the generic format returns a dot (.) as a decimal separator. The ‘generic’ subselect can be added to almost any selectable which returns date/time or real numbers and can be used in both the Java APIs as well as the MQL APIs. It should not be used in where clauses or access filters. print businessobject OBJECTID select modified.generic dump; |