Category and LabelThe OTScript feature can be associated with a category. You can specify a label for a feature. Note:
If no category is defined, the default category is
Extensions.
You can also declare the category in the label. METHOD ... CATEGORY "Customer" LABEL "Quantity"; // the category is Customer and label is Quantity METHOD ... LABEL "Quantity"; // the category is Extensions and label is Quantity METHOD ... LABEL "Customer,Quantity"; // the category is Customer and label is Quantity Class PatternThe following pattern enables you to define a class: Syntax
CLASS <class_name> -doc : <type>; Attribute PatternThe following pattern enables you to define an attribute: Syntax ATTRIBUTE <class_name>.<attribute_name> -doc : <type> CATEGORY <category> LABEL <label>; Method PatternYou can provide a help text for methods: The following pattern enables you to define a method: Syntax METHOD <type_name>.<method_name>() -doc : {
...
<code>
...
} LABEL "<category>,<label>"
HELPTEXT "<tooltip>";
Description
ExampleThis example shows a method, which counts the number of requirements that are refined.Satisfy the following prerequisites:
Insert the following code in the OTScript tab of your template. This code creates a method named Number of refined requirements, which is added to the Customer category: PACKAGE PLM;
METHOD `Requirement Group`.getDerivedRequirementsCount() -doc : {
TMP reqSpecs := `rel_Requirement Group Content`.`to_Requirement Specification`;
$CNT(reqSpecs.getAllRequirements()[$SOME(`rel_Derived Requirement`)])
} CATEGORY "Customer" LABEL "Number of refined requirements"
HELPTEXT "Get the number of requirements that are refined by other requirements";
| |||||||||||||||||||||||