Adding or removing tagged values in your model - using the model debugger
No edit summary
(Automatically adding template at the end of the page.)
 
(6 intermediate revisions by 3 users not shown)
Line 1: Line 1:
For background, see [[Using the model debugger to change the model itself]]
For background, see: [[Training:Using the model debugger to change the model itself|Using the model debugger to change the model itself.]]


==== To find all viewmodels with a specific tag ====
==== To find all ViewModels with a specific tag: ====
<code>Span.allInstances->select(s | s.TaggedValue->select(tv | tv.Tag.toUpper='MVC')->notEmpty)</code>
Span.allInstances->select(s | s.TaggedValue->select(tv | tv.Tag.toUpper='MVC')->notEmpty)


==== To add the tag MVC to all viewmodels that don't already have it ====
==== To add the tag MVC to all ViewModels that don't already have it: ====


  Span.allInstances->select(s | s.TaggedValue->select(tv | tv.Tag.toUpper='MVC')->isEmpty)->forEach(s |
  Span.allInstances->select(s | s.TaggedValue->select(tv | tv.Tag.toUpper='MVC')->isEmpty)->forEach(s |
Line 14: Line 14:
   )
   )
  )
  )
To add the tag '''Eco.BusinessDeleteRule''' to all association ends that don't already have it setting it to '''NeedNotBeEmptyNoWarning'''
To add the tag '''Eco.BusinessDeleteRule''' to all association ends that don't already have it, set it to '''NeedNotBeEmptyNoWarning:'''
  AssociationEnd.allInstances->select(s | s.TaggedValue->select(tv | tv.Tag='Eco.BusinessDeleteRule')->isEmpty)->forEach(s |  
  AssociationEnd.allInstances->select(s | s.TaggedValue->select(tv | tv.Tag='Eco.BusinessDeleteRule')->isEmpty)->forEach(s |  
  let newtag = TaggedValue.Create in  
  let newtag = TaggedValue.Create in  
Line 24: Line 24:
  )
  )
  [[Category:MDriven Designer]]
  [[Category:MDriven Designer]]
{{Edited|July|12|2024}}

Latest revision as of 15:27, 10 February 2024

For background, see: Using the model debugger to change the model itself.

To find all ViewModels with a specific tag:

Span.allInstances->select(s | s.TaggedValue->select(tv | tv.Tag.toUpper='MVC')->notEmpty)

To add the tag MVC to all ViewModels that don't already have it:

Span.allInstances->select(s | s.TaggedValue->select(tv | tv.Tag.toUpper='MVC')->isEmpty)->forEach(s |
let newtag = TaggedValue.Create in
  (
    newtag.Tag := 'MVC';
    newtag.Value := 'True';
    newtag.ModelElement := s
  )
)

To add the tag Eco.BusinessDeleteRule to all association ends that don't already have it, set it to NeedNotBeEmptyNoWarning:

AssociationEnd.allInstances->select(s | s.TaggedValue->select(tv | tv.Tag='Eco.BusinessDeleteRule')->isEmpty)->forEach(s | 
let newtag = TaggedValue.Create in 
  (
    newtag.Tag := 'Eco.BusinessDeleteRule';
    newtag.Value := 'NeedNotBeEmptyNoWarning';
    newtag.ModelElement := s
  )
)
This page was edited 100 days ago on 02/10/2024. What links here