Adding or removing tagged values in your model - using the model debugger
No edit summary
No edit summary
Line 6: Line 6:
==== 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)->collect(s |
  Span.allInstances->select(s | s.TaggedValue->select(tv | tv.Tag.toUpper='MVC')->isEmpty)->forEach(s |
  let newtag = TaggedValue.Create in
  let newtag = TaggedValue.Create in
(
  (
     newtag.Tag := 'MVC';
     newtag.Tag := 'MVC';
     newtag.Value := 'True';
     newtag.Value := 'True';
Line 14: Line 14:
   )
   )
  )
  )
[[Category:MDriven Designer]]
To add the tag '''Eco.BusinessDeleteRule''' to all association ends that don't already have it setting 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
  )
)
[[Category:MDriven Designer]]

Revision as of 17:29, 16 March 2019

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 setting 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 97 days ago on 02/10/2024. What links here