- A simple print business object with Tcl clause.
MQL<2>print bus Assembly SA-300356 0 select id owner locker tcl;
{business object} {Assembly} {SA-300356} {0} {{id} {{id}
{20083.46775.20193.6352}}} {{owner} {{owner} {Joe Product-Manager}}}
{{locker} {{locker} {bucknam}}}
It might appear that there is some redundancy in the output in the select-result-items section. The first occurrence of an item (for example owner, above) matches the given select item and is followed by name/value pairs that resulted from the select item. Often the name field is redundant. However, when the select item results in many returned items (for example attribute.value or from.id) the name field gives added details. For more information, see Example 3.
- The same print bus command including the Dump clause:
MQL<3>print bus Assembly SA-300356 0 select id owner locker dump tcl;
{{20083.46775.20193.6352}} {{Joe Product-Manager}} {{smith}}
- A business object Print with a select that returns multiple items:
MQL<4>print bus Assembly SA-300356 0 select from.id tcl;
{business object} {Assembly} {SA-300356} {0} {{from.id}
{{from[Documentation].id} {20083.46775.30402.24363}}
{{from[Analysis].id} {20083.46775.30631.62767}} {{ from[Analysis].id}
{20083.46775.30631.41948}} {{from[Plan].id} {20083.46775.30632.60059}}
{{from[Required Tools].id} {20083.46775.30639.24886}} {{from[BOM-As Designed].id}
{20083.46775.30663.9546}} {{from[BOM-As Designed].id} {20083.46775.6577.56182}}}
- The same print of multiple items with the Dump clause, eliminating headers:
MQL<5>print bus Assembly SA-300356 0 select from.id dump tcl;
{{20083.46775.30402.24363} {20083.46775.30631.62767}
{20083.46775.30631.41948} {20083.46775.30632.60059}
{20083.46775.30639.24886} {20083.46775.30663.9546}
{20083.46775.6577.56182}}
- A temporary query with simple select in Tcl list output (with newline between object records):
MQL<6>temp query bus Assembly SA* 0 limit 5 select id locker tcl;
{businessobject} {Assembly} {SA-300.125} {0} {{id} {{id}
{20083.46775.31292.44899}}} {{locker} {{locker} {}}}
{businessobject} {Assembly} {SA-300127} {0} {{id} {{id}
{20083.46775.20133.58276}}} {{locker} {{locker} {bucknam}}}
{businessobject} {Assembly} {SA-300195} {0} {{id} {{id}
{20083.46775.20117.54372}}} {{locker} {{locker} {bucknam}}}
{businessobject} {Assembly} {SA-300315} {0} {{id} {{id}
{20083.46775.20173.48444}}} {{locker} {{locker} {}}}
{businessobject} {Assembly} {SA-300356} {0} {{id} {{id}
{20083.46775.20193.6352}}} {{locker} {{locker} {bucknam}}}
- The same temp query with Dump clause:
MQL<7>temp query bus Assembly SA* 0 limit 5 select id locker dump tcl;
{Assembly} {SA-300.125} {0} {{20083.46775.31292.44899}} {{}}
{Assembly} {SA-300127} {0} {{20083.46775.20133.58276}} {{bucknam}}
{Assembly} {SA-300195} {0} {{20083.46775.20117.54372}} {{bucknam}}
{Assembly} {SA-300315} {0} {{20083.46775.20173.48444}} {{}}
{Assembly} {SA-300356} {0} {{20083.46775.20193.6352}} {{bucknam}}
- A temp query selecting attributes and their values:
MQL<8>temp query bus * * * limit 1 select current revision attribute.value tcl;
{businessobject} {NC Program} {GH02456} {A} {{current} {{current} {Planned}}}
{{revision} {{revision} {A}}} {{attribute.value} {{attribute[MachineType].value}
{Machine Center}} {{attribute[Process Type].value} {Unknown}} {{attribute[Written By].value}
{}} {{attribute[File Suffix].value} {.TAP}}}
- The same temp query with Dump clause:
MQL<9>temp query bus * * * limit 1 select current revision attribute.value dump tcl;
{NC Program} {GH02456} {A} {{Planned}} {{A}} {{Machine Center} {Unknown} {}{.TAP}}
- An expand set with newlines for each object:
MQL<10>expand set "A1 - To Do" limit 5 select bus id tcl;
{1} {Documentation} {to} {Drawing} {SA-300356} {A} {{id} {{id}
{20083.46775.30402.28967}}}
{1} {Analysis} {to} {Cost Analysis} {DA-3001356-1} {A} {{id} {{id}
{20083.46775.65320.27011}}}
{1} {Analysis} {to} {Design Analysis} {DA-3001356-1} {C} {{id} {{id}
{20083.46775.26552.19182}}}
{1} {Plan} {to} {Assembly Process Plan} {SA-300356} {0} {{id} {{id}
{20083.46775.62627.22040}}}
{1} {Required Tools} {to} {Setup Instructions} {SA-300356} {A} {{id} {{id}
{20083.46775.17589.27146}}}
- The same expand set with Dump clause:
MQL<11>expand set "A1 - To Do" limit 5 select bus id dump : tcl;
{1} {Documentation} {to} {Drawing} {SA-300356} {A} {{20083.46775.30402.28967}}
{1} {Analysis} {to} {Cost Analysis} {DA-3001356-1} {A} {{20083.46775.65320.27011}}
{1} {Analysis} {to} {Design Analysis} {DA-3001356-1} {C} {{20083.46775.26552.19182}}
{1} {Plan} {to} {Assembly Process Plan} {SA-300356} {0} {{20083.46775.62627.22040}}
{1} {Required Tools} {to} {Setup Instructions} {SA-300356} {A} {{20083.46775.17589.27146}}
- An expand bus with Dump clause but no RECORDSEP:
MQL<12>expand bus Vehicle M60000 0 from recurse to 1 select rel id dump tcl;
1tclDOCUMENTATIONtcltotclManualtclM60001tcl0tcl974.54590.24670.436
1tclDesigned Part QuantitytcltotclFront AxletclM66000tcl0tcl974.54590.42602.58431
- A typical Tcl program:
set output [mql expand set "A1 - To Do" select bus id dump : tcl]
set count [llength $output]
foreach row $output {
set level [lindex $row 0]
set relation [lindex $row 1]
set tofrom [lindex $row 2]
set busobj [lrange $row 3 5]
set busid [join [lindex $row 6]]
puts “\[level: $level\] relationship\[$relation\] $tofrom $busid”
}
With results similar to:
[level: 1] relationship[Documentation] to 20083.46775.30402.28967
[level: 1] relationship[Analysis] to 20083.46775.65320.27011
[level: 1] relationship[Analysis] to 20083.46775.26552.19182
[level: 1] relationship[Plan] to 20083.46775.62627.22040
[level: 1] relationship[Required Tools] to 20083.46775.17589.27146
[level: 1] relationship[BOM-As Designed] to 20083.46775.30337.38798
[level: 1] relationship[BOM-As Designed] to 20083.46775.29481.42882
[level: 1] relationship[Product Spec to BOM] from 20083.46775.32142.28396
.
.
.