Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Next revision Both sides next revision | ||
tutorial:hybrid_model [2020/12/31 02:55] admin [Generate Test Cases] |
tutorial:hybrid_model [2020/12/31 17:32] admin [Loop through Data Set] |
||
---|---|---|---|
Line 162: | Line 162: | ||
To write a line of script in TRIGGER for transition " | To write a line of script in TRIGGER for transition " | ||
- | {{wiki: | + | {{wiki: |
+ | IDE should navigate to //SCRIPT// tab. Since the TRIGGER for transition " | ||
+ | {{wiki: | ||
+ | |||
+ | Click " | ||
+ | |||
+ | {{wiki: | ||
+ | |||
+ | Alternatively you can add the skeleton TRIGGER script for the transition by pressing Ctrl-I while your cursor is placed on a blank line in //SCRIPT// tab and select transition " | ||
+ | |||
+ | {{wiki: | ||
+ | |||
+ | |||
+ | |||
+ | TRIGGER script is just a //groovy// function, go ahead and add two lines of scripts as show below: | ||
+ | |||
+ | {{wiki: | ||
+ | |||
+ | |||
+ | The " | ||
+ | |||
+ | Save the changes and run the model again. Examine //Script Log// (click on the script log button {{wiki: | ||
+ | |||
+ | Below is the first few lines from the script log: | ||
| | ||
Line 197: | Line 220: | ||
==== Loop through Data Set ==== | ==== Loop through Data Set ==== | ||
+ | The data set can also be looped programmatically by scripting as follows: | ||
+ | | ||
+ | |||
+ | // rewind dataset to first row | ||
+ | | ||
+ | |||
+ | // retrieve data | ||
+ | | ||
+ | |||
+ | // advance to next row, if rowIdx == 0, all rows exhausted | ||
+ | | ||
+ | Please note that the data set being looped programmatically as above can not be attached to the transition at the same time. | ||