5.6.5. foreach=”reference.all”
Context |
reference/code instructions/foreach=”reference.all” |
Signature |
foreach=”reference.all” |
Description |
foreach=”reference.all” instructs the CodeComposer to generate code for each reference of the current model object, including all of the references of the model objects the current model object extends directly or indirectly. Warning foreach=”reference” only works when a current model object is present in the context: either specify foreach=”object” or refer directly to an object with object=”<object name>” in your code instruction. Note CodeComposer will place the current model reference in the context with name modelReference for use in build-in functions, custom functions and snippets during generation. |
Exceptions |
This foreach raises an InvalidPatternException when the context does not contain a model object: Error InvalidPatternException: invalid pattern: trying to create a <patternType> foreach reference but currentModelObject is null. Either specify a foreach=”object” in pattern or refer directly to a object of the model with the package=”<package name>” and object=”<object name>” statement. Failed to produce code due to invalid pattern. |
Example |
CodeComposer input TODO: example code instruction TODO: example custom functions TODO: example model CodeComposer output TODO: example output |