/
FORM_INSERT ()

FORM_INSERT ()

FORM_CLONE(form_code, [task_ref], [condition], [position], [hidden], [insert_closed], [parameters], [new_form_code])

API Version

All

Short description

FORMULA Description

Input Parameters

Parameter

Type

Default

Required

Description

Parameter

Type

Default

Required

Description

form_code

String/Number

 

Yes

A FORM CODE referring to the FORM TEMPLATE that will be used the to create the new FORM instance

task_ref

String/Number

 

No

If not provided, the FORM cloned will be inserted in the current TASK.

Otherwise it can be one of the following:

  • A TASK_CODE referring to the TASK where the cloned FORM will be inserted. It must be.a TASK in the same ADMISSION. If more than one TASK is found whit the specified TASK_CODE, then the last one will be used.

  • The TASK ID of the TASK where the cloned FORM will be inserted. It must be.a TASK in the same ADMISSION.

condition

Boolean

true

No

Must be true to clone the FORM, possible true options: ('true', 's', '1'), others are considered as false value. It can be a FORMULA

position

String/Number

“LAST”

No

The position in the TASK where the FORM is inserted.

  • “LAST”: insert as the last FORM in the destination TASK

  • “FIRST”: insert as the last FORM in the destination TASK

  • A numeric value

hidden

String/Number

0

No

indicate whether the inserted FORM must be hidden. Possible values are:

  • 0, ““: Always visible

  • 1, “ALWAYS”: Always hidden

  • 2, “ON_TASK_CLOSED” : Hidden when the TASK that contains the FORM is closed

  • 3, “ON_TASK_OPEN”: Hidden when the TASK that contains the FORM is open

  • 4, “ON_FORM_CLOSED”: Hidden when the the FORM is closed

insert_closed

Boolean

false

No

If true, the inserted FORM will be inserted closed.This parameter will not have effect if HIDDEN = “ALWAYS”

parameters

 

 

No

The parameter called parameters allows to provide a list of values that will be assigned to the ITEMS of the FORM inserted

It must be a JSON string representing an array of objects with initial values that will be applied to the ITEMS of the ACTIVITIES. Each array item must be an object with 2 properties:

  • code: name of the DATA CODE to which the value will be assigned

  • value: value assigned

The values can be either  simple values or arrays.

The values assigned to each parameter will be stored in the newly created ACTIVITY into the ITEMS whose ITEM_CODE matches the property "code"

See the following examples:

Example of passing 2 parameters with simple values:

[ {"code":"PARAMETER.RELATIVE", "value":"RELATIVE.PARENT(M)"}, {"code":"PARAMETER.DIAGNOSE.ICD10", "value":"H60.20"} ]
  • The ITEM with ITEM_CODE = "PARAMETER.RELATIVE" will be assigned the value "RELATIVE.PARENT(M)"

  • The ITEM with ITEM_CODE = "PARAMETER.DIAGNOSE.ICD10" will be assigned the value "H60.20"

Note that if the TEMPLATE of the new ACTIVITY does not contain an ITEM with a ITEM_CODE named as any of the parameters provided, then a new ITEM will be created (hidden)

Example of passing 2 parameters with array values:

[ {"code":"HEART_RATE", "value":[87, 97]}, {"code":"HEART_RATE_TIME", "value":["12:00:00","16:00:00"]} ]
  • An array of ITEMs with ITEM_CODE = "HEART_RATE" will be created, the ITEM in row 1 will be assigned with the value 87, and the ITEM in row 2 will be assigned with the value 97

  • An array of ITEMs with ITEM_CODE = "HEART_RATE_TIME" will be created, the ITEM in row 1 will be assigned with the value "12:00:00", and the ITEM in row 2 will be assigned with the value "16:00:00"

If the TEMPLATE of the new FORM already contains an array of ITEM with ITEM_CODE that match the parameter names, then the necessary rows will be added to fit as many values as provided.

Otherwise, a new array of ITEMs will be created (hidden) for each parameter with multiple values

new_form_code

String

 

No

FORM_CODE that will be assigned to the inserted FORM. If no value is specified, the FORM_CODE of the template will not be changed.

Return value

Reference to the cloned FORM.

Execution

On closing the FORMThe ITEM containing this FORMULA must be defined as type 'ACTION' (which are always executed when a FORM is closed)

Examples

Formula

Description

Formula

Description

FORM_INSERT(“CLINICAL_ASSESSMENT“)

Inserts a new FORM based on the FORM TEMPLATE with code “CLINICAL_ASSESMENT” into the current TASK (where the formula is executed)

FORM_INSERT(“CLINICAL_ASSESSMENT“, “SPIRO_TASK”)

Inserts a new FORM based on the FORM TEMPLATE with code “CLINICAL_ASSESMENT” into a TASK of the same ADMISSION with TASK_CODE = “SPIRO_TASK“

FORM_INSERT(“CLINICAL_ASSESSMENT“, "SPIRO_TASK", 1, "FIRST")

Inserts a an activity (the one with TASK_CODE="F3" in the PROGRAM TEMPLATE) into the task with task code SPIRO_TASK. The inserted ACTIVITY will be placed the first into the TASK.

ACTIVITY_INSERT("CLINICAL_ASSESSMENT",, 1, "FIRST", , "ON_TASK_CLOSED", 1)

Inserts a new FORM based on the FORM TEMPLATE with code “CLINICAL_ASSESMENT” into the curent TASK.

The inserted FORM will be placed the first into the TASK and will be closed, and will be hidden when the TASK is closed.

ACTIVITY_INSERT("SPIRO.TECHASS.PBD",,1,,,[{"code":"TECHASSCOMM1", "value":"abc"}, {"code":"TECHASSQP1", "value":"xyz"}])

Inserts a new FORM based on the FORM TEMPLATE with code “CLINICAL_ASSESMENT” into the current TASK.

The ITEMS of the insert FORM with ITEM CODES  “TECHASSCOMM1” and “TECHASSQP1” will be initialized respectively with the values “abc” and “xyz” respectively



Related content