How to set the event id of triggered operation from a user defined value?

Technote (FAQ)


Question

How to set the event id of triggered operation from a user defined value?

Answer

You can set the event id of triggered operation from a user defined value by running a VB script. To do this, follow the steps below:
  1. Create a Rhapsody model
  2. Create a class named "ClassA" under "Default" Package
  3. Create triggered operations under class "ClassA"
  4. Go to Tools -> VBA -> Visual basic Editor
  5. Type the code found below in a new Module of the VB editor and save it.
  6. Run the macro named a by selecting Tools -> VBA->Macro -> generate_id
Sub generate_id()
  Dim itemVal As Integer
  itemVal = 1 ' Initial value for the triggered operation
  For Each element In getProject.packages
   For Each subelement In element.classes
    For Each item In subelement.operations
      If item.metaClass = "Operation" Then
        item.setPropertyValue "CG.Event.Id", itemVal
        itemVal = itemVal + 1 ' To sequentially increment the value of triggered operation
      End If
    Next
   Next
  Next
End Sub
The macro would now set the triggered event ids to start with 1 and increment it by 1 for every triggered operation.
7.1AnswerProduct versionPartner ContentInternal ContentCategoryReference IDAuthor

Historical Number

11339

Rate this page:

(0 users)Average rating

Add comments

Document information


More support for:

Rational Rhapsody
General Information

Software version:

Version Independent

Operating system(s):

Platform Independent

Reference #:

1324178

Modified date:

2010-11-23

Translate my page

Machine Translation

Content navigation