List Requirements of a Function

Hello,

in my M2Doc documentation I am listing all functions and I want to add in the description of every function all requirements that are linked to the function.

I have tried things like

mySysFunction.eInverse('target')->filter(CapellaRequirements::CapellaIncomingRelation).source

but I can’t get the requirement into the documentation.

Has anyone solved this?

== Capella 7.0.0, M2Doc 3.3.3 ==

This should work. Did you add the requirements nsURI to your template using the template properties wizard ?
http://www.polarsys.org/capella/requirements

Yes, I have these three regarding requirements in the template properties:

image

OK, with this one now I get all requirements of a function, but the text is the html.

{m: SF.eInverse(‘target’)->filter(CapellaRequirements::CapellaIncomingRelation).source.ReqIFText}

  1. Is it possible to convert the html output to simple text?

  2. How can I loop over the requirements?

  3. If I try the expression in the M2Doc-Interpreter no result is shown - why?
    selection.eInverse(‘target’)->filter(CapellaRequirements::CapellaIncomingRelation).source.ReqIFText

Ok, answer to 2) How to loop works:

Still the html format of the output is not so good to read…

  1. you can use HTMLServices.
  2. maybe you selected an element from a diagram and needed to use .target to get the semantic element ?

Many thanks - works nice now.
And yes, forgot about the .target… :innocent:

1 Like