Book a Demo

Author Topic: Assigning values to a variable in an activity diag  (Read 3861 times)

Dmitri Pisarenko

  • EA Novice
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
Assigning values to a variable in an activity diag
« on: February 12, 2012, 06:21:55 am »
Hello!

Imagine following situation:

*) I have a class MyClass in a class diagram. It has a method called myMethod that returns some value.

*) In an activity diagram, I want to model following code

someVariable = instanceOfMyClass.myMethod();

where instanceOfMyClass is an instance of MyClass.

Question: Is there a predefined action for such situation (call a method of an object and assign its return value to a variable) in Enterprise Architect?

Thanks in advance

Dmitri Pisarenko

philchudley

  • EA User
  • **
  • Posts: 750
  • Karma: +22/-0
  • EA Consultant / Trainer - Sparx Europe
    • View Profile
Re: Assigning values to a variable in an activity
« Reply #1 on: February 12, 2012, 08:07:26 am »
As a start I suggest you look at a

[highlight]call operation action [/highlight]

Select an action element from the toolbox as usual and then select [highlight]Call Operation[/highlight] from the menu
Right-click the action and select[highlight] Advanced | Assign Operation...[/highlight]
You will then be able to navigate to the operation of your choice
This will create an [highlight]ActionPin (for the result of the call)[/highlight] as a child of the action
This Pin can then be added to the diagram from the Project Browser

For operations that do not return values, this pin could simply be deleted

Cheers

Phil
Models are great!
Correct models are even greater!

Dmitri Pisarenko

  • EA Novice
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
Re: Assigning values to a variable in an activity
« Reply #2 on: February 13, 2012, 04:04:47 am »
Thanks!