OneScript
  • Welcome to OneScript
  • OneScript Overview
    • Dates and Times
    • Sets
    • Types
    • Fields
      • Helper Fields
      • Labels
      • Standard Text
    • Snapshots
    • State Management
    • Future Features
  • Get OneScript
  • Macro Overview
    • Macro Virtual Machine
    • Code Instructions
  • Standard Libraries
    • Core
    • Data
    • Interview Model
  • Linker Overview
    • Objects
  • Contact Us
Powered by GitBook
On this page
  1. OneScript Overview

State Management

Unlike many other languages OneScript passes data between its environment and the code using state management. Other languages will pass a simple parameter and only at the beginning of running the program. OneScript can handle more complex data structures with state management and can share changes during the running of the program, not just at the entry point.

For full access to state management the OneScript Software Development is available. For general access we have built a set of environments that support the running of a survey.

State management is a key part of the interview experience and a special part of the Macro Virtual Machine. Importantly state management supports multiple threads (or interviews) running the same script without them interfering with one another. State management also supports the transfer of data between the Macro Virtual Machine and its environment. For example, passing the question details from the script to the presentation of the question.

State management is accessed through the state keyword. For example, the following loads the Interview Context from the Virtual Machine’s state:

InterviewContext context = state.Context;

The OneScript environment will reserve certain properties of the state for its own use. Context is a good example of this. A full list of reserved context properties is as follows:

Property

Description

Context

InterviewContext

What really makes the state managment exciting is the ability to add and change objects from within OneScript that can interoperate with its environment.

state.Person = person;

In the above example, an object is passed back to Macro Virtual Machine and the environment it is in. The potential of this allows for any environment to work with OneScript. For example, integration with a CRM package sending out interviews and collecting key data in the CRM database,

PreviousSnapshotsNextFuture Features

Last updated 3 years ago