|
Hi Daniel,
You probably want to try the http://www.metacase.com/support/51/manuals/mwb/Mw-5_2_1.html" rel="nofollow - MERL Primer , if you haven't already: that has an example of this on the second page. For a property containing an object or objects, you navigate into the object with do :PropName {}. Within the loop you are in the context of the object in the property, and so can access properties of it. In your case, do :Address { :Street }.
You can find more about accessing properties in the first command in the MERL Reference, http://www.metacase.com/support/51/manuals/mwb/Mw-6_1_1.html" rel="nofollow - 6.1.1 Property :
The property command can be used as a direct output command, writing the value of the property to the current output stream. It can also be used as a condition in if statements. If the property data type is a NonProperty or a Collection, it can also be used as the argument to do or dowhile loops. |
More about the do loop can be found in http://www.metacase.com/support/51/manuals/mwb/Mw-6_3.html" rel="nofollow - 6.3.3 - 6.3.11 : it's the workhorse of MetaEdit+ navigation.
As well as the MERL http://www.metacase.com/support/51/manuals/mwb/Mw-5_1.html" rel="nofollow - Getting Started , http://www.metacase.com/support/51/manuals/mwb/Mw-5_2.html" rel="nofollow - Primer and http://https//www.metacase.com/support/51/manuals/mwb/Mw-6.html" rel="nofollow - Reference , a great way to get familiar with MERL is to work through some of the generators in the demo repository. Either pick a particular project that you know has generators, e.g. the Digital Watch or Mobile UI examples, or simply open them all. You can open a MERL Generator Editor from the main MetaEdit+ toolbar and press Ctrl+Shift+F to do an http://www.metacase.com/support/51/manuals/mwb/Mw-5_3_1.html#Index214" rel="nofollow - Advanced Find over all modeling languages, allowing you to find examples of how to use the various MERL commands. You can then run the generator, stepping through it with the MERL http://www.metacase.com/support/51/manuals/mwb/Mw-5_4.html" rel="nofollow - Generator Debugger , or by setting a http://www.metacase.com/support/51/manuals/mwb/Mw-5_3_1.html#Index217" rel="nofollow - Breakpoint at the part you're interested in and simply generating.
If you're looking for an example of how to deal with a particular kind of model structure, and what MERL might offer for that, you can approach the problem from the other end: find a similar structure in the demo repository. E.g. if you wanted to find a property holding an object, you could open a http://www.metacase.com/support/51/manuals/mwb/Mw-2_6.html" rel="nofollow - Property Tool from the Metamodel menu, set its Filter to just Object, and press Open. The first two types found are in BPMN, which doesn't have a generator, but it's third time lucky with Animation, from the Turtle Graphics language. Use Advanced Find in a MERL Generator Editor to see where Animation is used, and you'll see _DoActionAnimation(), which accesses properties of the Animation object as if we are in it. But how did we get in it? Switch to the Hierarchical view of the generator list, and you can see that _DoActionAnimation() is called from _Python(). But where? From the pop-up menu, choose http://www.metacase.com/support/51/manuals/mwb/Mw-5_3_1.html#_Ref325460684" rel="nofollow - Show Call Context , and it will take you to the call site:
do :Animation { _DoActionAnimation() } |
So to get inside an object in a property, use do :PropName {}.
|