Understanding Collection Methods

The first item in a component interface collection is always indexed as item 1 from PeopleCode, which is consistent with other PeopleCode processing. From Java and C++ programs, this item is indexed as item 0.

Component Interface Collection Properties

This table describes the component interface collection properties:

Data Collection Method Action, Usage

Count

Returns the number of items in a collection.

Use these interfaces to call with other programming languages.

  • Java: long getCount()

  • C++: PSI32 <CiCollectionName>_GetCount (HPSAPI_<CI_COLLECTION_NAME> hCol)

ItemByName

(not used in PeopleCode)

Returns the property in the collection. It takes Name as a parameter.

Use these interfaces to call with other programming languages.

  • Java: ICompIntfcPropertyInfo itemByName(String Name)

  • C++: CompIntfcPropertyInfoCollection_ItemByName (HPSAPI_COMPINTFCPROPERTYINFOCOLLECTION, LPTSTR Name)

InsertItem(Index)

Inserts a new item. This is equivalent to clicking the Add button to insert a new row when online. It takes Index as a parameter and follows the same conventions for performing business rules (PeopleCode) as the online system.

Use these interfaces to call with other programming languages.

  • Java: <CiCollectionName> insertItem( long Index)

  • C++: HPSAPI_<CI_COLLECTION_ITEM> <CiCollectionName>_InsertItem(HPSAPI_<CI_COLLECTION_NAME> hCol, PSI32 Index)

DeleteItem(Index)

Deletes the item that is designated by Index. This is equivalent to clicking the Delete button to delete the selected row when online.

Use these interfaces to call with other programming languages.

  • Java: boolean deleteItem(long Index)

  • C++: BOOL <CiCollectionName>_DeleteItem(HPSAPI_<CI_COLLECTION_NAME> hCol, PSI32 Index)

Item(Index)

Takes an item number as a parameter and returns a definition of the type that is stored in the specified row in the collection. For example, if the collection is a data collection, the return value is a DataRow. If the collection value is a PropertyInfoCollection, then the return value is a PropertyInfo definition, and so on.

Use these interfaces to call with other programming languages.

  • Java: <CiCollectionName> item(long Index)

  • C++: HPSAPI_<CI_COLLECTION_ITEM> <CiCollectionName>_Item(HPSAPI_<CI_ COLLECTION_NAME> hCol, PSI32 Index) (HPSAPI_COMPINTFCPROPERTYINFOCOLLECTION, PSI32)

ItemByKeys(keys)

Identifies and finds a specific item, based on keys. The keys vary according to the design of the collection.

Use these interfaces to call with other programming languages.

  • Java: <CiCollectionName> itemByKeys(String Key1, String Key2, …)

  • C++: HPSAPI_<CI_COLLECTION_ITEM> <CiCollectionName>_ItemByKeys (HPSAPI_<CI_COLLECTION_NAME > hCol, LPTSTR Key1, LPTSTR Key2, …)

CurrentItem

Returns the current effective DataRow in the collection. The behavior is consistent with effective date rules that are used online. This method works with effective-dated records only.

Use these interfaces to call with other programming languages.

  • Java: <CiCollectionName>currentItem()

  • C++: HPSAPI_<CI_COLLECTION_ITEM> <CiCollectionName>_ CurrentItem(HPSAPI_<CI_COLLECTION_NAME> hCol)

CurrentItemNum

(CurrentItemNumber)

Returns the item number of the current effective DataRow in the collection. The behavior is consistent with effective date rules that are used online. This method works with effective-dated records only.

Use these interfaces to call with other programming languages.

  • Java: long currentItemNum()

  • C++: PSI32 <CiCollectionName>_ _CurrentItemNum(HPSAPI_<CI_COLLECTION_NAME> hCol)

GetEffectiveItem(DateString, SeqNum)

Returns the DataRow that would be effective for the specified date and sequence number. This is a more general case of the GetCurrentItem function, which returns the definition that is effective at this moment. This method works with effective-dated records only.

Use these interfaces to call with other programming languages.

  • Java: <CiCollectionName> getEffectiveItem(String Date, long SeqNum)

  • C++: HPSAPI_<CI_COLLECTION_ITEM> <CiCollectionName>_ GetEffectiveItem(HPSAPI_<CI_COLLECTION_NAME> hCol, LPTSTR Date, PSI32 SeqNum)

GetEffectiveItemNum(DateString, SeqNum)

Returns the item number of the DataRow in the collection that would be effective for the specified date and sequence number. This is a more general case of the GetCurrentItemNum function, which returns the number of the definition that is effective at this moment. This method works with effective-dated records only.

Use these interfaces to call with other programming languages.

  • Java: long getEffectiveItemNum(string Date, long SeqNum)

  • C++: <CiCollectionName>_GetEffectiveItemNum( HPSAPI_<CI_COLLECTION_NAME> hCol, LPTSTR Date,PSI32 SeqNum)