Pass App Data to XSight Topics Using JavaScript / Blocky

Before you begin

This procedure requires an XSight topic. See Create an XSight Topic.

About this task

Use this procedure to map widget data to your XSight topic data connection rule using JavaScript or Blocky

Procedure

  1. Open your app in the Canvas.
  2. Select the widget that triggers the transfer of information from your app to SOTI XSight.
  3. From the Events tab, select the Events list.
  4. Select an event, like On Click, to trigger the information transfer.
  5. From Actions, select to add a new action.
  6. From the dropdown list, select either Run Javascript or Run Blockly. Then proceed with the respective procedure
    Action Procedure
    Run Javascript
    1. Select Script Editor. The Script Editor window opens.

      Script Editor window

    2. From Script Name, give a brief description of the script's purpose.
    3. In the editor, create script commands to pass widget data to your XSight topic data connection rule. Use the command Snap.xSightTopic.setValue("[topicName]", "[topicValue]").
      Examples: In the following example, the [topicValue] is the value held by the widget.
      Snap.xSightTopic.setValue("PatientName",Snap.widgets.textbox.getValue("txtPatientName"));
                                                          Snap.xSightTopic.setValue("SugarLevel",Snap.widgets.radiobutton.getValue("radSugarLevel").val);
      Tip: To find and insert an XSight topic name into your code, select Global variables button. Select the XSight Topic tab and choose the name of the XSight topic.
    4. Select Done.
    Run Blockly

    1. Select Blockly Editor. The Blockly Editor window opens.

      Blockly Editor window

    2. In Blockly Name, give a brief description of the script's purpose.
    3. Expand the left-hand menu and select XSight Topics.

      Blocks for XSight topics

    4. Drag a Set block onto the canvas.
    5. From the block's select list, select the name of the XSight topic to receive the data.
    6. From Widget Values, drag a block of the same type as the widget containing the source data onto the canvas.
    7. From the block's select list, select the source widget's name.
    8. Drag and insert the block into the to bubble in the Set block.

      The configured Set block

    9. Select Save.

Results

Widget values from your SOTI Snap app can pass to SOTI XSight through your XSight topic data connection rule.

What to do next

Switch to SOTI XSight and configure SOTI XSight Live View to use your XSight topic data. See Map XSight Topics in SOTI XSight.