Using the Process Analyst > Process Analyst for Developers > Automation Model > IObjectViewItem.PutField [Method]

IObjectViewItem.PutField [Method]

Sets the display string in a field's cell for a specified column on this item.

The IObjectViewItem interface is hierarchical to two levels - pane and then pen. The scope of the PutField method will depend on what type of item it is called on. To set 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

Parameters

columnName

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

fieldValue

[in] The string you would like to be displayed in the field for this column/pen intersection.

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 field cannot be set, then GeneralFailure is returned.

Calling Syntax

This example writes the value "someValue" to the CustomColumn field 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
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.PutField "CustomColumn", "someValue" 'set the value of the CustomColumn 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
_ObjectCallMethod(hPenItem, "PutField", "CustomColumn", "someValue"); // Set the value of the CustomColumn field
END