ade_odgetrecfield

Land Desktop Development ARX CPP SDK

Up a level
ade_odgetrecfield
 
 

Gets a field value using a record ID.

struct resbuf*

ade_odgetrecfield(

ade_id recID,

char* field);

Returns a field value (type varies) or NULL.

recID Record ID returned by ade_odgetrecord.
field Field name.

This function uses the record ID assigned by ade_odgetrecord to get the value of a particular field. This means of getting an object data field value is generally faster than any other.

You must release the resbuf.

The following sample creates a selection set of all entities in the current drawing using acedSSGet(). Each entity in the selection set is passed to ade_odgetrecord() which returns a record id. This record id along with other required parameters, are passed to ade_odgetrecfield() which stores its results in a resbuf which is displayed. Then it releases the resbuf, as required.

struct resbuf* pOdRecFieldRb = NULL;
ads_name selectionSet;
ads_name ename;
char* pszOdTable = "table1";
char* pszOdField = "FIELD1";
int recnum = 0;
acedSSGet("x", NULL, NULL, NULL, selectionSet);
long ssLength;
acedSSLength( selectionSet, &ssLength; );
ade_id recordId;
for( int i = 0; i < ssLength; ++i )
{
    if( acedSSName(selectionSet, i, ename) == RTNORM )
    {
        recordId = ade_odgetrecord(ename, pszOdTable, recnum);
        pOdRecFieldRb = ade_odgetrecfield(recordId, pszOdField);
        struct resbuf* rb = pOdRecFieldRb;
        while(rb != NULL) {
            acutPrintf(
                "\nThe current entity has %s object data with a %s value of: %s"
                , pszOdTable, pszOdField, rb->resval.rstring);
            rb = rb->rbnext;
        }
    }
}
acutRelRb(pOdRecFieldRb);