The Item method returns a member object of the collection. The class of the object depends on the collection; for example, calling the Item method of the Fields collection returns a Field object. Specify the member you want by passing its name or index.

Syntax

Item(ItemName as String) as Object

Item(Index as Integer) as Object

Parameters
ItemName
The name of the member to return an object for.

Index
The index of the member to return an object for.

Return Value
A reference to the member object if it exists or null if not.

Example
This example, which could be used as the code for the DataEngine.GetCustomMetaData script for a project, changes the caption for a specific field. This is commonly used when the user can change the headings of fields in the application. Although this is shown as a hard-coded caption in this example, in actual use, you'd look up the caption for the field wherever your application stores it.

Visual FoxPro

lparameters toApplication as SQApplication
local loField as Field
loField = toApplication.DataEngine.Fields.Item('CUSTOMER.COMPANY')
loField.Caption = 'Organization Name'

VBScript

function Main(Application)
dim Field
set Field = Application.DataEngine.Fields.Item("CUSTOMER.COMPANY")
Field.Caption = "Organization Name"
end function

JavaScript

function Main(Application) {
var Field = Application.DataEngine.Fields.Item('CUSTOMER.COMPANY') ;
Field.Caption = 'Organization Name' ;
}

C#

public static bool DataEngine_GetCustomMetaData(SFQApplication sfqApplication)
{	
  Field field = sfqApplication.DataEngine.Field.Item("CUSTOMER.COMPANY");
  field.Caption = "Organization Name";
}

VB.NET

public shared function DataEngine_GetCustomMetaData(sfqApplication as SFQApplication) _
    as Boolean
  Field field = sfqApplication.DataEngine.Field.Item("CUSTOMER.COMPANY")
  field.Caption = "Organization Name"
End Function

See also

AddItem | Collections

© Stonefield Software Inc., 2023 • Updated: 06/06/16
Comment or report problem with topic