You are here: Core Reference > Coding > Scripting > ServerObject.Name

ServerObject.Name

The ServerObject.Name property returns the Name value for the database item that is referenced in the script by the defined ServerObject. The Name value consists of the item's name only; it does not contain the path of the item.

Syntax

ServerObject.Name

Description

Accesses the Name property of a database item that is referenced in the script by the defined ServerObject.

Arguments

None.

Returns

Name {string}

The Name of the database item that is referenced in the script by a ServerObject.

Example:

A script is created that, when executed, will cause a message box to display the name of a point. The point is named 'Tank Level' and it is stored in a Group named 'Tanks'.

The script is as follows:

  • Set objLevelPoint = Server.FindObject("Tanks.Tank Level")
  • If Not objLevelPoint Is Nothing Then
    • PointName = objLevelPoint.Name
    • MsgBox PointName
  • Else
    • MsgBox "Point not found"
  • End If

Where:

  • objLevelPoint is the name of the variable that stores the ServerObject that is returned by the FindObject function.
  • Server.FindObject("Tanks.Tank Level") instructs the script to search for a database item named 'Tank Level' in a Group named 'Tanks'.
  • If Not objLevelPoint Is Nothing Then tells the script what to do if the objLevelPoint variable has a value. The If Not objLevelPoint Is Nothing means that if the objLevelPoint is not nothing (that is, the objLevelPoint has a value) then proceed with the following action.
  • PointName = objLevelPoint.Name instructs the script to set the PointName variable to have the same value as the Name property of the objLevelPoint variable. Remember that the PointName is only set to be the same as the objLevelPoint.Name property if the GroupName has a value.
  • MsgBox PointName instructs the script to display a message box containing the value that is stored by the PointName variable (the value is the same as the Name property of the objLevelPoint variable).
  • Else MsgBox "Point not found" tells the script what to do if the objLevelPoint variable does not have a value (i.e. If objLevelPoint Is Nothing). In this case, the script will display a message box containing the message "Point not found".

ClearSCADA 2015 R2