"CONTEXT" OBJECT CODE

"CONTEXT" OBJECT CODE

Object code format

CONTEXT.property


Introduced in API version 2.8.1

OBJECT CODE execution context

When any OBJECT CODE is evaluated, the WS-API assigns a context that is necessary to find the appropriate values.

For example, the OBJECT CODE ITEM{n}.ANSWER should return the value assigned to an ITEM with reference “n”, but an ITEM like the requested one may exist in different FORMS, TASKS, ADMISSIONS and even PROGRAMS, so, how does the WS-API now where to search for the ITEM?

Depending on where the OBJECT CODE is used, the WS-API assigns a context that determines how to evaluate it.

For example consider an ITEM in a FORM whose value is calculated by means of aFORM FORMULAS with the OBJECT CODE ITEM{n}.ANSWER. When this formula is evaluated, the WS-API sets the following context

  • FORM: The FORM that contains the ITEM whose formula is going to be evaluated. This prevents retrieving information from other FORMS that contain a similar ITEM

  • TASK: The TASK that contains the ITEM whose formula is going to be evaluated. This prevents retrieving information from other TASKS that contain a similar ITEM

  • ADMISSIONS: The ADMISSION that contains the ITEM whose formula is going to be evaluated. This prevents retrieving information from other ADMISSIONS that contain a similar ITEM

  • CASE: : The CASE assigned to the ADMISSION that contains the ITEM whose formula is going to be evaluated. This prevents retrieving information from ADMISSIONS of other CASES.

  • SUBSCRIPTION: The SUBSCRIPTION of the ADMISSION that contains the ITEM whose formula is going to be evaluated. This prevents retrieving information from other ADMISSIONS in other SUBSCRIPTIONS.

  • PROGRAM: The PROGRAM of the ADMISSION that contains the ITEM whose formula is going to be evaluated. This prevents retrieving information from other ADMISSIONS in other SUBSCRIPTIONS.

Any of these context objects may be overridden if the OBJECT CODE explicitly requests it. For example, if we change slightly the previous example formula to TASK.ITEM{n}.ANSWER, then no FORM will be included in the execution context, because we are requesting the value of an ITEM in any FORM of the TASK where the formula is executed, so in this case only the TASK, ADMISSION, CASE, SUBSCRIPTION and PROGRAM object would be added to the context, but not the FORM object.

Other examples overriding the default context:

  • ADMISSION.ITEM{n}.ANSWER: No TASK nor FORM objects will be added to the context so that any ITEM in the ADMISSION (that contains the ITEM whose formula is executed) can be found

  • SUBSCRIPTION.ITEM{n}.ANSWER: No ADMISSION, TASK nor FORM objects will be added to the context so that any ITEM in the SUBSCRIPTION (of the ADMISSION that contains the ITEM whose formula is executed) can be found

Types of execution contexts

The type of execution context is determined by the place where an OBJECT CODE is used. The following table shows the possible scenarios and how the execution context is defined:

OBJECT CODE used in

Execution context objects

OBJECT CODE used in

Execution context objects

Any property of an ITEM of a FORM

FORM, TASK, ADMISSION, CASE, SUBSCRIPTION, PROGRAM

Any property of a FORM (e.g. the title)

FORM, TASK, ADMISSION, CASE, SUBSCRIPTION, PROGRAM

Any property of a REPORT (e.g. the title)

FORM, TASK, ADMISSION, CASE, SUBSCRIPTION, PROGRAM

Contents of a REPORT defined into a TASK of an ADMISSION

TASK, ADMISSION, CASE, SUBSCRIPTION, PROGRAM

Any property of a TASK (e.g. the title)

TASK, ADMISSION, CASE, SUBSCRIPTION, PROGRAM

Contents of an ADMISSION REPORT

ADMISSION, CASE, SUBSCRIPTION, PROGRAM

Contents of a PROGRAM REPORT

SUBSCRIPTION, PROGRAM

Properties

PROPERTY

DESCRIPTION

PROPERTY

DESCRIPTION

CONTEXT.PROGRAM

All the OBJECT CODES have at least a PROGRAM object set in the execution context. Any OBJECT CODE that refers to objects that belong to a PROGRAM (e.g. PROTOCOL, SUBSCRIPTION, TASKS, FORMS, ITEMS…) will only be searched into the context PROGRAM

CONTEXT.SUBSCRIPTION

If the execution context has a SUBSCRIPTION object assigned, then any OBJECT CODE that refers to objects that belong to an ADMISSION (e.g. ADMISSIONS, TASKS, FORMS, ITEMS…) will only be searched into the context SUBSCRIPTION

CONTEXT.ADMISSION

If the execution context has an ADMISSION object assigned, then any OBJECT CODE that refers to objects that belong to an ADMISSION (e.g. TASKS, FORMS, ITEMS…) will only be searched into the context ADMISSION