Please ensure Javascript is enabled for purposes of website accessibility
Powered by Zoomin Software. For more details please contactZoomin

AVEVA™ Plant SCADA

IObjectViewItem​.GetField [Method]

  • Last UpdatedJul 18, 2023
  • 2 minute read

Returns the string value of a displayed field for a specified column on this item.

The IObjectViewItem interface is hierarchical to two levels - pane and then pen. The result of the GetField method will depend on what type of item it is called on. To access the fields for a pen, for example, you have to first get the items collection for the pane item, then get the pen item.

Defined As

  • [VBA] GetField(ColumnName As String) as String

  • [Cicode] STRING GetField (STRING ColumnName)

  • [C++] HRESULT GetField (BSTR ColumnName, BSTR *Val)

Parameters

ColumnName

[in] The string ID uniquely identifying the column whose field value is being queried for.

Execution Result

If the property get succeeds, the return value will be Success. If the return variable is bad, the return value will be InvalidArgument. If the ColumnName does not exist, InvalidArgument will be returned.

Calling Syntax

This example gets the Scale property of the first pen in the first pane. It assumes there is a valid Item as retrieved from an Items Collection from an ObjectView. (for example, VBA: objectView.Items.Item(1))

[VBA]

Sub Example()
Dim paneItem As Object
Dim penItem As Object
Dim fieldValue As String
Set paneItem = Test_CPA.ObjectView.Items.Item(1) ' Get the first pane of the ObjectView
Set penItem = paneItem.Items.Item(1) ' Get the first pen from the first pane
penItem.GetField "Scale", fieldValue ' Get the value of the scale field
End Sub

[Cicode]

FUNCTION Example(OBJECT hObjectView)
OBJECT hPaneItems = _ObjectGetProperty(hObjectView, "Items");
OBJECT hPaneItem = _ObjectCallMethod(hPaneItems, "get_Item", 1);
// Get the first pane of the ObjectView
OBJECT hPenItems = _ObjectGetProperty(hPaneItem, "Items");
// Get the collection of pens from the first pane
OBJECT hPenItem = _ObjectCallMethod(hPenItems, "get_Item", 1);
// Get the first Pen item
STRING sValue;
_ObjectCallMethod(hPenItem, "GetField", "Scale", sValue);
// Get the value of the scale field
END

In This Topic
TitleResults for “How to create a CRG?”Also Available in