Print Page | Close Window

use generator script with decomposition

Printed From: MetaCase
Category:
Forum Name: MetaEdit+
Forum Description: All topics relating to MetaEdit+ or DSM
URL: http://www.metacase.com/forums/forum_posts.asp?TID=924
Printed Date: 28.Mar.2024 at 10:30
Software Version: Web Wiz Forums 12.05 - http://www.webwizforums.com


Topic: use generator script with decomposition
Posted By: edward22243
Subject: use generator script with decomposition
Date 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?



Replies:
Posted By: stevek
Date 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 */





Posted By: edward22243
Date 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  


Posted By: stevek
Date 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.



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.05 - http://www.webwizforums.com
Copyright ©2001-2022 Web Wiz Ltd. - https://www.webwiz.net