Question & Answer
Question
How do I access the Initial Values data using the API in IBM Rational Rhapsody?
Cause
You want to access the initial value data set in your MicroC project but the data is not found under any of the attributes.
Answer
Usually the initial value data is stored under the attribute initial value
field.
![](/support/pages/system/files/support/swg/rattech.nsf/0/f9bcfab308d2c5ea852580590044ca2a/Content/0.174.jpg)
Using the API you can access this data using the IRPAttibute.getDefaultValue()
method. This code example assumes you have selected an attribute in the Rhapsody model:
![](/support/pages/system/files/support/swg/rattech.nsf/0/f9bcfab308d2c5ea852580590044ca2a/Content/2.3C10.jpg)
However, using the MicroC profile you can specify initial values at a global level using the package's
initial value
tab:![](/support/pages/system/files/support/swg/rattech.nsf/0/f9bcfab308d2c5ea852580590044ca2a/Content/7.3258.jpg)
This present a problem accessing the data since there is no dedicated method in the API to retrieve it as seen above.
This data is stored in the Annotations of the package and its tags/dependencies. The code example assumes you have selected a package in the Rhapsody model:
![](/support/pages/system/files/support/swg/rattech.nsf/0/f9bcfab308d2c5ea852580590044ca2a/Content/12.47FC.jpg)
The source code is also attached.
[{"Product":{"code":"SSB2MU","label":"IBM Engineering Systems Design Rhapsody"},"Business Unit":{"code":"BU059","label":"IBM Software w\/o TPS"},"Component":"General Information","Platform":[{"code":"PF016","label":"Linux"},{"code":"PF033","label":"Windows"}],"Version":"8.0;8.0.1;8.0.2;8.0.3;8.0.4;8.0.5;8.0.6;8.1;8.1.1;8.1.2;8.1.2.1;8.1.3;8.1.4;8.1.5","Edition":"","Line of Business":{"code":"LOB59","label":"Sustainability Software"}}]
Product Synonym
Rational Rhapsody
Was this topic helpful?
Document Information
Modified date:
27 May 2022
UID
swg21993167