ade_qlsetquery

Land Desktop Development ARX CPP SDK

Up a level
ade_qlsetquery
 
 

Changes a query name, description, or the category it belongs to.

int

ade_qlsetquery(

ade_id qry_id,

char* info,

struct resbuf* value);

Returns RTNORM or an error code.

qry_id Query ID.
info Type of information to modify. See the Query Properties table below.
value New value (type varies).
Query Properties
name Name of query (RTSTR), up to 31 characters long. Must be unique, contain no spaces, and start with an alphanumeric character.
description Description of query (RTSTR), up to 132 characters long. Can contain spaces. Must be unique and start with an alphanumeric character.
category Category ID, (RTREAL).

This function does not change file name or storage type.

A query gets a name and an ID when it is saved to a query category of the query library. A new query that you have not yet saved does not have a name or an ID.

The following sample creates a resbuf containing the updated option value. The id for the query to be modified is then obtained with ade_qlqrygetid(). Ade_qlsetquery() is called with all required parameters, the returned result code is checked for RTNORM and displayed. Then it releases the resbuf, as required.

char* pszQueryProperty = "name";
char* pszQueryName = "RtList";
struct resbuf* pQueryPropValRb = acutBuildList(RTSTR, "MyRenamedQuery", 0);
ade_id queryId = ade_qlqrygetid(pszQueryName);
if(queryId != ADE_NULLID) {
    int returnCode = ade_qlsetquery(queryId, pszQueryProperty, pQueryPropValRb);
    if (RTNORM == returnCode) {
        acutPrintf(
            "\nThe query %s property has been modified."
            , pszQueryProperty);
    }
    else {
        acutPrintf(
            "\nThe query %s property has not been modified."
            , pszQueryProperty);
    }
}
acutRelRb(pQueryPropValRb);