Using Macros
Calculation of an assessed characteristic value can be done via a macro.
*For more details on the use of HOPEX macros, see the All about starting with APIs technical article.
Creating a macro
To create a macro:
1. Open the properties of the Scoring rules of interest.
2. Click the arrow at the right of the Select a Macro field and select Create.
The macro creation wizard opens.
3. Select the check box corresponding to the type of macro you want to use:
Create a (VB)script macro
Create a Java macro
Create a C# Macro
Use an existing macro
Create a component-based macro
4. Click Next.
5. If the macro you have created can be reused for another scoring rule, select the Reusable box.
6. Click OK.
Implementing a macro
The macro should have a method called 'compute' with the following signature:
Sub compute(mgobjScoringRule As MegaObject, mgobjValueContext As MegaObject, mgcolAnswers As MegaCollection , mgobjAssessedValue As MegaObject)
End Sub
List of arguments:
mgobjScoringRule: current quotation rule.
mgobjAssessedValue: assessed characteristic value to be computed.
mgobjValueContext: assessment node of current assessed characteristic value.
mgcolAnswers: list of answers figuring in computing the assessed characteristic value.
Example of Scoring Rule Macros
HOPEX GRC proposes a default macro: "Compute average among one or more answers". This macro can be reused.
Other macros are available:
 
Macro
Explanation
Compute average among one or more answers
This macro aggregates one or more answers of a given question, computing the average of the answers' internal values. The result is used to obtain a unique answer, which is the one whose internal value is the closest to the computed average. In case of conflict, the algorithm returns the answer with the smallest internal value.
Compute max among one or more answers
This macro aggregates one or more answers of a given question, returning the answer with the highest internal value.
Compute min among one or more answers
This macro aggregates one or more answers of a given question, returning the answer with the smallest internal value.
Control Level Scoring Rule
 
OK/KO Scoring Rule