i4SCADA Knowledge Base

SmartEditor Client-side tutorials

Abstract

Curious what is the actual function of a Client-side Signal? Check out these tutorials covering the most common use cases for the Client-side Signals usage.

Use Client-side Signals in a state switching action
Abstract

Check out this simple i4SCADA SmartEditor use case and learn how to use temporary Signals. Have fun while switching the lights on and off.

The present tutorial will support you with publishing a simple i4SCADA SmartEditor project, using Client-side Signals.

  1. Open the i4SCADA SmartEditor with Administrative privileges.

  2. A new project is opened and ready to use. Go to the Toolbox panel and add the i4-core extension to your project page. 

  3. Return to the Toolbox panel and add a wf-switch-basic extension to your project page.

    SE_page.jpg
  4. Visit the Object Properties panel of the  wf-switch-basic extension.

  5. Go to the Signal Name property, under Object Properties of the extension. 

    wf-switch-basic_PRs.jpg
  6. Type in the Client-side Signal starting with prefix "local://" and your Client-side Signal custom name. Click button OK to confirm and preserve the change. 

    Client_Signal_name.jpg
  7. Open the i4SCADA Service Manager and start the i4SCADA Server

    Service_Mgr.jpg
  8. Return to the i4SCADA SmartEditor and press the toolbar button Publish.

  9. The HTML output is generated and published. 

  10. Open the published website. 

  11. The published switch button is displayed. The switch is currently on neutral position.

    Switch_neutra_.jpg
  12. Press the button ON to turn on the switch.

  13. The switch is enabled.

    Switch_ON.jpg
  14. Press the button OFF to turn off the the switch.

  15. The switch is disabled.

    Switch_OFF.jpg
Use wf-local-script extensions for Client Signals
Abstract

Spice things up and add your own scripts to write custom values to your temporary Signals, in i4SCADA SmartEditor web applications.

  1. Open the i4SCADA SmartEditor with Administrative privileges.

  2. A new project is opened and ready to use. Go to the Toolbox panel and add the i4-core extension to your project page.

  3. Return to the Toolbox panel and add a wf-local-script extension to your project page.

    Local_Script_extension.jpg
  4. Open the Object Properties panel of the  wf-local-script extension.

    Input_Signal_Name.jpg
  5. Click on the Input Signal Names property and add one or more Signals to the Collection.

    In our case we shall use "Buffer 1 " and "Buffer 2", or "Local Second" and "Local Minute".

    Input_Signals_panel.jpg
  6. Set the Output Signal Name. The Output Signal name should be set considering the Client Signals syntax local://[...].

    For this tutorial, we will set either "local://localBuffer" or "local://localLocals".

    Output_signal_name.jpg
  7. Click on the Script property and add your script.

    Example 1:

    if((valuesArray[0] != 0) && (valuesArray[1] != 0)) return 1;else return 0;
    Script.jpg

    If both "Buffer 1" and "Buffer 2" are not equal to 0 then the Output Signal "local://localBuffer" is set to 1, else it is set to 0.

    The script is executed when any of the Input Signals changes the value.

    Example 2:

    Another script which builds the sum of the values of "Local Minute" and "Local Second" is:

    const myValue = valuesArray[0] + valuesArray[1]; return myValue;
  8. The Output Signal can be used anywhere, where a normal Signal is used. For example, add in the i4SCADA SmartEditor project, two wf-value-display extensions.

    Value_Display_extensions.jpg
  9. Open the Object Properties panel of the wf-value-display extension and add the Signal Name "local://localBuffer"

    Signal_Vlaue.jpg
  10. Open the i4SCADA Service Manager and start the i4SCADA Server

  11. Return to the i4SCADA SmartEditor and Publish the project.

  12. Open the project in your browser.

  13. Values are displayed at run-time.

    Values_are_displayed.jpg