ACAPI_​ListData_​Search

Searches for a listdata.

    GSErrCode  ACAPI_ListData_Search (
        API_ListData*     listdata
    );

 

Parameters

listdata
[in/out] Parameters of the listdata. The type and setIndex of the listdata must be passed in the typeID and the setIndex fields in the listdata header. The code and/or the keycode of the listdata must be passed in the code and the keycode fields in the listdata. The setIndex and the index fields of the listdata header are used as the output parameters to return the setIndex/index to the searched listdata.

 

Return Values

NoError
The function has completed with success.
APIERR_BADKEYCODE
Invalid code or keycode was passed.

For other common errors see the list of error codes.

 

Remarks

This function is used to search for a listdata, identified by the setIndex, the typeID and the code/keycode fields in the listdata header. Units and keys are searchable by code, components and descriptors are searchable by code and/or keycode. The All sets of listing database are sorted by keycode.

 

API_ListData_Head

 

setIndex

required (if it’s 0 – search in all sets)

typeID

required

API_ListDataID

keycode

code

API_KeyID or API_UnitID

not exist

required

API_ComponentID or API_DescriptorID

required

optional

 

Example


API_ListData  listdata;
char          buffer[256];
GSErrCode     err;

BNZeroMemory (&listdata, sizeof (API_ListData));

listdata.header.setIndex = 0;
listdata.header.typeID   = API_ComponentID;
CHCopyC ("003", listdata.component.keycode);
CHCopyC ("", listdata.component.code);

err = ACAPI_ListData_Search (&listdata);
if (err == NoError) {
    sprintf (buffer, "Set index: %d,  key code: \"003\"", listdata.header.setIndex);
    ACAPI_WriteReport (buffer, false);

    err = ACAPI_ListData_Get (&listdata);
    while (err == NoError && CHEqualASCII (listdata.component.keycode, "003", CS_CaseInsensitive)) {
        sprintf (buffer, " Code: \"%s\", name: %s", listdata.component.code, listdata.component.name);
        ACAPI_WriteReport (buffer, false);

        listdata.header.index++;
        err = ACAPI_ListData_Get (&listdata);
    }
}

 

Requirements

Version: API 2.1 or later
Header: ACAPinc.h

 

See Also

API_ListData,
Listing Manager, API Functions