MetaCase Homepage
Forum Home Forum Home > > MetaEdit+
  New Posts New Posts RSS Feed - Collection of graph
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Collection of graph

 Post Reply Post Reply
Author
Message
Gali View Drop Down
Member
Member
Avatar

Joined: 28.Jun.2018
Points: 5
Post Options Post Options   Thanks (0) Thanks(0)   Quote Gali Quote  Post ReplyReply Direct Link To This Post Topic: Collection of graph
    Posted: 02.Jul.2018 at 03:51
Hello,

I define an object (Event) in which one attribute (scenes) is a collection of another graph(SceneDesign).
Now I want to output everything in all the scenes in the event. what should I do.


Gali
Back to Top
stevek View Drop Down
MetaCase
MetaCase
Avatar

Joined: 11.Mar.2008
Points: 549
Post Options Post Options   Thanks (0) Thanks(0)   Quote stevek Quote  Post ReplyReply Direct Link To This Post Posted: 02.Jul.2018 at 08:30
You can use do to iterate over the collection property, and inside each Scene Design graph there you can use foreach to iterate over the objects there:
foreach .Event
'Event: ' id newline
   do :scenes
   {  '   Scene graph: ' id newline
      foreach .()
      {  '      ' id ': ' type newline
      }    
   }
}
Better style is to refactor the parts inside Scene Design into a new generator, which you write in the Scene Design graph type. The top-level generator thus has:
foreach .Event
'Event: ' id newline
   do :scenes
   {  _Contents()
   }
}
and in a new Generator Editor in Scene Design:
_Contents()
'Scene graph: ' id newline
foreach .()
'      ' id ': ' type newline
}
It's important to save generators in the right graph type. When calling a sub-generator, it is looked up in the generators of the current graph's type. The current graph changes when you navigate into a different graph, as you do here inside do :scenes {_Contents()}. The sub-generator _Contents() will thus be looked up in the generators of the Scene Design graph type.


Edited by stevek - 02.Jul.2018 at 08:47
Back to Top
Gali View Drop Down
Member
Member
Avatar

Joined: 28.Jun.2018
Points: 5
Post Options Post Options   Thanks (0) Thanks(0)   Quote Gali Quote  Post ReplyReply Direct Link To This Post Posted: 02.Jul.2018 at 09:15
Thank you~Smile
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 10.16
Copyright ©2001-2013 Web Wiz Ltd.

This page was generated in 0.031 seconds.