Page History
This page shows examples of calculated fields in data blocks, including their definition in Enterprise Studio. The examples vary from simple calculations to more complex calculations.
You may notice that sometimes spaces are used in the expression and sometimes not. It is optional. You can choose to use spaces for readability, but it is not required and it does not affect the functionality.
Info |
---|
For defining calculated fields it is assumed that you have some familiarity with scripting. |
Excerpt |
---|
On this page: |
Table of Contents | ||
---|---|---|
|
Data block with one calculated field with only a calculation
The following data block has one calculated field with only a calculation. This is sufficient because the calculated field as well as the attribute fields used in the expression are of a number-related type (real and integer). Because of these no mappings are needed.
stability:
Code Block |
---|
prod(<incidents>,<severity>) |
Data block with one calculated field including input mappings
The following data block has one calculated field of type integer. Since the other attribute fields that are used in the expression are of type enumeration, input mappings are needed to convert their values.
overallriskvalue:
Code Block |
---|
@InputMapping<technicalrisk>(1,2,3,4,5) @InputMapping<businessrisk>(1,2,3,4,5) @InputMapping<securityrisk>(1,2,3,4,5) avg(<technicalrisk>,<businessrisk>,<securityrisk>) |
Data block with one calculated field including an output mapping
The data block below has one calculated field of type enumeration and therefor needs an output mapping in the expression. The result of the calculation (a number) needs to be mapped back to an enumeration value that fits the type of the calculated field.
time:
Code Block |
---|
@OutputMapping(5, 10, 15) min(<bv> / 5, 1 ) * 10 + <tv> |
Data block with two calculated fields, one using the other's calculated value
The data block in the following example has two calculated fields defined, one of type real and one of type integer. The calculated field of type real uses the calculated value of the other calculated field.
businessvalue:
Code Block |
---|
3.0*<strategicimportance> + 2.0*<importanceforotherapplications> + 3.0*<importanceforusers> + 3.0*<regulatorycompliancelevel> |
importanceforusers:
Code Block |
---|
avg(<nrofeffectiveusers>, 0.1*<nrofpotentialusers>) |
Data block with four calculated fields, one using the others' calculated values
The data block below has four calculated fields, of which one is using the calculated values of the other three fields. The calculated fields use a variety of expressions.
aggregatedtechnicalquality:
Code Block |
---|
@InputMapping<architecturalfit>(0,5,10) @InputMapping<interoperability>(0,2.5,5,7.5,10) @InputMapping<maintainability>(2,4,10,50,100) @InputMapping<scalability>(0,2.5,5,7.5,10) @OutputMapping(2,4,6,8) avg(<agility>,4*<architecturalfit>,4*<availability>,-1.0*<complexity>,<interoperability>,4*<maintainability>,3*<resilience>,<scalability>,<stability>) |
complexity:
Code Block |
---|
prod(<fanin>,<fanout>) |
maintainability:
Code Block |
---|
@OutputMapping(20,40,60,80) 100-prod(<changerequests>,<changesize>,<effortperchange>) |
stability:
Code Block |
---|
prod(<incidents>,<severity>) |
Content by Label | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
Panel | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||||
Check out the free Enterprise Studio introductory eLearning course to learn about data blocks.
|