MetaCase Homepage
Forum Home Forum Home > > MetaEdit+
  New Posts New Posts RSS Feed - Accessing properties of subobjects
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Accessing properties of subobjects

 Post Reply Post Reply
Author
Message
Tahir View Drop Down
Major Contributor
Major Contributor


Joined: 01.Mar.2012
Points: 27
Post Options Post Options   Thanks (0) Thanks(0)   Quote Tahir Quote  Post ReplyReply Direct Link To This Post Topic: Accessing properties of subobjects
    Posted: 02.Mar.2012 at 18:34
Hello again!

How do we access properties of sub- and subsub ojects using MERL? The following is my scenario.

I have a graph with an object named Obj1. Obj1 has a property named Prop1.

The datatype for Prop1 is another object named Obj2.

The Obj2 in turn have a property named Prop2.

Prop2 has a data type of a Number.

I want to check the value of Prop2 when writing a generator for the graph with Obj1.

Best Regards
/Tahir
Back to Top
stevek View Drop Down
MetaCase
MetaCase
Avatar

Joined: 11.Mar.2008
Points: 643
Post Options Post Options   Thanks (0) Thanks(0)   Quote stevek Quote  Post ReplyReply Direct Link To This Post Posted: 02.Mar.2012 at 19:06
You can iterate over the object or objects in a property with do or dowhile. E.g. to go through all Obj1s and list the value of their Prop1 object's Prop2:
foreach .Obj1
{  do :Prop1
   {   :Prop2
   }
   newline
}
 
If Prop1 doesn't contain any object, then "do :Prop1 {}" will do nothing.
 
For more details, please see the Workbench manual's chapter on MERL, 5.3.4 Control and navigation commands, 'Do loop'.
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.05
Copyright ©2001-2022 Web Wiz Ltd.

This page was generated in 0.023 seconds.