Print Page | Close Window

Bind the sub-generator and related component

Printed From: MetaCase
Category:
Forum Name: MetaEdit+
Forum Description: All topics relating to MetaEdit+ or DSM
URL: https://www.metacase.com/forums/forum_posts.asp?TID=930
Printed Date: 27.Mar.2026 at 02:15
Software Version: Web Wiz Forums 12.05 - http://www.webwizforums.com


Topic: Bind the sub-generator and related component
Posted By: fuyyy021
Subject: Bind the sub-generator and related component
Date Posted: 23.Mar.2021 at 16:02

Hi. Thanks for reading this message. I have a usage problem. I have read the manual and samples, but I have not found the answer.

Now I have to use DSM to design a model to generate the JavaScript code. I am not sure if I can bind the sub-generator and related component. I mean when I drag a component and put it into the main interface, the related sub-generator will be added automatically.




Replies:
Posted By: jpt
Date Posted: 23.Mar.2021 at 21:22

Not sure if understood correctly the part on  …the related sub-generator will be added automatically”, but when the generator is executed, it always operates in the context provided by the currently accessed model element and its environment. Normally generators start based on a selected graph (see https://metacase.com/support/55/manuals/mwb/Mw-5_2.html" rel="nofollow - Primer ).

If the graph contains components they can be thus accessed e.g. with foreach .Component {} and if there is interface element related it can be accessed with the above foreach e.g. by do >().Interface command.



Posted By: fuyyy021
Date Posted: 23.Mar.2021 at 21:37
Hi,

I mean can I link the code generator to the component as a property? Because now I need to design a tool for the people who do not know programming. They are just the experts in their own fields such as Finance. The result is that we pre-write code generators and link them to components, they can drag the components they need and put them into the main interface. After they put all components into the interface, they just need to click on the button to execute the code generator. And the browser will be opened and run the Javascript code.


Posted By: jpt
Date Posted: 23.Mar.2021 at 22:39
Yes, it is also possible to select a generator to be run based on a value given in a property.

Example: ObjectType 'Component' has a PropertyType 'Output' which is a list of values to be selected by user. Possible list values could be 'code', 'test', 'doc'. 

There is then generators made with names code, test and doc accordingly. The generator for calling selected would be:

foreach .Component; {
subreport :Output; run
}

In case the componentX has value 'test' in Output property, it would call generator 'test' and so on. 

You may see a bit similar example in https://metacase.com/support/55/manuals/watchtut/we-Preface_.html" rel="nofollow - Watch tutorial : WatchFamily graph has a property 'Generation target platform' which is used to call different generators like C# or Java.  Search in Generator Editor string :Generation target platform and you can see its usage.



Posted By: fuyyy021
Date Posted: 23.Mar.2021 at 23:00
Thanks for your reply. It's very helpful. I will check the manual and test it.



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