Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Overview

The platform is equipped with a range of built-in methods and libraries housed within Script.Classes, designed to streamline your project management tasks and facilitate seamless interaction with remote assets and tags. These methods serve as powerful tools that can be customized to suit diverse application requirements, providing the means to establish smooth transitions between different project states or dynamic configurations.

In this documentation, you will find guides on using class methods and understanding feature requirements to effectively utilize functionalities like Remote Assets and Tags. Additionally, we illustrate the necessary steps to use these methods and integrate them into your projects, enhancing functionality and efficiency.Resumo do conteúdo da página

On this page:

Table of Contents
maxLevel3
stylenone


ServerMain Class Methods

Classes in-depth

Content

Class workflow

Content

Defining a Class

Content

Calling Classes

Content

ServerMain Class methods

This section has information on some methods accessible by the ServerMain Class pre-built in any new project and how to use them in your projects. This section covers the following ServerMain class methods:

These methods can be adapted to fit various application requirements and ensure smooth transitions between different project states or dynamic configurations. To utilize methods from the ServerMain Class, follow these steps:

  1. Navigate to Scripts → Classes → ServerMain.

  2. Within the ServerMain class, you can create methods to execute code during the server processes.

  3. To implement these methods, go to Scripts → CodeEditor.

  4. In the CodeEditor, write the necessary code for the methods you've created in the ServerMain Class.

These methods can be adapted to fit various application requirements and ensure smooth transitions between different project states or dynamic configurations

For instance, you can utilize ServerMain Class methods to reestablish communications after any project or server state change. This applies to scenarios like starting the project or switching between active and standby states in a two-project redundancy setup.


Anchor
OnActivateMethod
OnActivateMethod
OnActivate

The OnActivate method is called invoked when the a project transitions from an inactive state to an active state. This can occur when a project is initially started , such as during initial startup or when a standby project becomes active in a redundancy scenario.

When implemented, this method is called every time the project/server goes from OFF (inactive) to ON (active), running the set of instructions defined within the method's code block.

 

Code Block
Code Block
languagec#
titleOnActivate Method
public void OnActivate(){
     //Write your code here 
}

This method executes the instructions within its code block whenever the project or server changes from inactive to active.


Anchor
OnDeactivateMethod
OnDeactivateMethod
OnDeactivate

The OnDeactivate OnDeactivate method is called invoked when the a project transitions from an active state to an inactive state. This can happen when a project , either when it is stopped or when an active project becomes inactive in during a redundancy scenario.When implemented, this method is called each time the project/server goes from ON (active) to OFF (inactive), running all the instructions defined within the method's code block. 

Code Block
languagec#
titleOnDeactivate Method
public void OnDeactivate(){
     //Write your code here 
}

Upon each change from active to inactive, this method executes the instructions specified within its code block.


Anchor
GetInitialDataSetParametersMethod
GetInitialDataSetParametersMethod
GetInitialDataSetParameters

The GetInitialDataSetParameters method is used to retrieve retrieves initial parameters for a DataSet. This can be helpful in setting up , which is useful for configuring dynamic data sources with varying diverse initial configurations.Calls the GetInitialDataSetParameters method for all Dataset→DBs configured in Edit→DataSets→DB, allowing to customize (for example, by reading from his XML file) each field (columns) of each Dataset→DB. If the return is settings. This method is called for every dataset configured in Datasets→DBs, enabling customization of each field (columns) within the Datasets→DBs, such as reading from an XML file. If the method returns "true", the configuration made in the Manager is overwritten replaced with the new values (obtained from the return output arguments[out]).

Code Block
languagec#
themeConfluence
titleGetInitialDataSetParameters Method
linenumberstrue
public bool GetInitialDataSetParameters(string datasetName, out string provider, out string database, out string connectionString, out string logonName, out string logonPassword, out string serverIP)
{
       //Write your code here
  return true;
}



Remote Assets and Tags Methods

In version 10, we no longer support the the Remote Tags API that allowerd the application to consume directly Assets and Tags defined in remote system such as OSIsoft PI System or OSIsoft PI AF (Asset Framework).

This must now be done using the TagProvider Connection. 

→ Learn more at UNS TagProvider Connections.

Calling a Class on HTML5 pages

How to call a class on HTML5 (@Script.Class.<ClassName>)?

Configuration 1

Content

Configuration 2

Content


In this section...

Page Tree
root@parent
spacesV10