4.7 DSL Quick Reference

This section provides a compact overview of the CBA ItemBuilder’s domain-specific language (DSL) for Finite-State Machines, Conditional Links, and Task Initialization. For detailed descriptions, refer to the sections referenced below.

4.7.1 FSM Syntax Summary

The Finite-State Machine syntax defines states, events, and rules that control dynamic item behavior (see section 4.4 for details).

Events: event1, event2, timerEvent 5.0;

Rules:
StartState -> RunState {true | set(variable, 1)}
RunState internal {event1 : condition | action1, action2}
RunState => EndState {event2 : condition | action}
RunState entry {| entryAction}
RunState exit {| exitAction}

Transitions: -> defines a Start Transition (executed once when a task starts). => defines a regular transition between states. internal defines event processing without changing the state.

Events: Events are listed after the Events: keyword, separated by commas. Timer events include a time interval in seconds (e.g., timerEvent 5.0). Events end with a semicolon.

Rule Structure: {EventName : Condition | Action1, Action2}. The event name, condition, and actions are all optional: {true | action} always executes, {event : condition} has no action, {event} triggers on event without condition or action.

4.7.3 Task Initialization Syntax Summary

Task Initialization sets task-specific default values when a task starts (see section 4.5 for details).

{StartPage : true | set(V_Task, 1) setFrozen(button1)}

The syntax follows the same structure as Conditional Links: the page name defines the start page, and operators are executed when the task begins.

4.7.4 Common Condition Operators

TABLE 4.4: Frequently used condition operators (see appendix A.2 for a complete listing).
Operator Example Description
==, <> V_score == 1 Equality / inequality comparison
<, <=, >, >= V_count > 3 Numeric comparisons
and, or, not A == 1 and B == 2 Logical operators
ifthenelse() ifthenelse(A==1, 10, 20) Returns value based on condition
matches() matches(input1, "^abc$") Text matches regular expression
complete() complete(frame1, 1) All options in select group selected
partial() partial(frame1, 1) At least one option selected
highlighted() highlighted(text1, "#FF0") Text highlighted with color
current_page() current_page(page2) Check if page is currently displayed
integer_value() integer_value(input1) Parse text input as integer
variable_in() variable_in(V, 1, 2, 3) Check if variable has one of the listed values
isCurrentTask() isCurrentTask(task0) Check if the given task is executing
elapsedTime() elapsedTime() > 5000 Milliseconds since task start
caretPosition() caretPosition(input1, 0) Cursor position in input field

4.7.5 Common Action Operators

TABLE 4.5: Frequently used action operators (see appendix A.2 for a complete listing).
Operator Example Description
set() set(V_score, 1) Set integer variable
setString() setString(V_name, "text") Set string variable
setBool() setBool(V_flag, true) Set boolean variable
reset() reset(V1, V2) Reset variables to 0
setFrozen() setFrozen(button1) Disable a component
setHidden() setHidden(panel1) Hide a component
setActive() setActive(radio1) Select a component
focus() focus(input1) Set input focus
openDialog() openDialog(feedbackPage) Open a dialog page
closeDialog() closeDialog(feedbackPage) Close a dialog page
raise() raise(myEvent) Trigger an FSM event
setMediaPlayer() setMediaPlayer(audio1, mp_start) Control audio/video playback
setEmbeddedPage() setEmbeddedPage(pa1, page2) Change page in PageArea
next_task() next_task() Navigate to next task
trace_text() trace_text("log entry") Write to trace log
concatenate() concatenate("A", "B") Join two text values
numberToString() numberToString(V_count) Convert number to text
floor(), round() set(V, floor(V2 / 3)) Rounding operators
changeLanguage() changeLanguage("de") Switch display language