MetaCase Homepage
Forum Home Forum Home > > MetaEdit+
  New Posts New Posts RSS Feed - use generator script with decomposition
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

use generator script with decomposition

 Post Reply Post Reply
Author
Message
edward22243 View Drop Down
Major Contributor
Major Contributor
Avatar

Joined: 19.Apr.2019
Points: 41
Post Options Post Options   Thanks (0) Thanks(0)   Quote edward22243 Quote  Post ReplyReply Direct Link To This Post Topic: use generator script with decomposition
    Posted: 25.Sep.2020 at 11:05
I have two graphs.
Graph 1 = ProductFamily
Graph 2 = Product
Graph 1 has objects Product that is a decomposition of graph 2.

Now I defined a MERL script for graph2 and I want in graph 1 to traverse all Products and call the MERL script foreach product. 
However, since I defined the script in graph2 I cannot see it. Do I have to copy the script to Graph 1? or is there a smarter way to use this script?
Back to Top
stevek View Drop Down
MetaCase
MetaCase
Avatar

Joined: 11.Mar.2008
Points: 641
Post Options Post Options   Thanks (0) Thanks(0)   Quote stevek Quote  Post ReplyReply Direct Link To This Post Posted: 25.Sep.2020 at 11:47
Do you mean you have two Graph TYPES, rather than two Graphs (instances of the same type)? I'll guess so, and also that the Product graph type is a decomposition of the Product object type in the ProductFamily graph type. 

Generators are defined for a graph type. The default display in the Generator Editor shows the call hierarchy of generators in the selected graph type. You just need your generator to navigate to the decomposition graph, and then any sub-generator you call will be looked up in the decomposition graph type. Let's call the generators ProductFamilyGenerator and ProductGenerator.

E.g. in ProductFamily:
ProductFamilyGenerator()
foreach .Product
{  do decompositions
   {  ProductGenerator()
   }
}

and in the decomposition graph type, Product:
ProductGenerator()
/* whatever you want */



Back to Top
edward22243 View Drop Down
Major Contributor
Major Contributor
Avatar

Joined: 19.Apr.2019
Points: 41
Post Options Post Options   Thanks (0) Thanks(0)   Quote edward22243 Quote  Post ReplyReply Direct Link To This Post Posted: 25.Sep.2020 at 15:43
Indeed two Graph types, my bad. And the Product graph type is a decomposition of the Product objecttype in ProductFamily graph type.

I used the same foreach-structure as you showed but I called a report instead of a function and that did not work. Changing the report to a function did the trick. 

Thank you  
Back to Top
stevek View Drop Down
MetaCase
MetaCase
Avatar

Joined: 11.Mar.2008
Points: 641
Post Options Post Options   Thanks (0) Thanks(0)   Quote stevek Quote  Post ReplyReply Direct Link To This Post Posted: 25.Sep.2020 at 16:09
Great, glad to hear you got it sorted. There are two syntaxes, both for calling sub-generators:
ProductGenerator()
or
subreport 'ProductGenerator' run

Changing between them wouldn't change whether it works, so probably it was some other typo that was the real cause. Both can supply arguments; only the latter allows you to build up the name of the sub-generator at run-time.


Edited by stevek - 25.Sep.2020 at 16:54
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.078 seconds.