Replaces a query condition.
int
ade_qrysetcond(
ade_id condition_id,
struct resbuf* condition);
Returns RTNORM or an error code.
| condition_id | Query condition ID to replace. |
| condition | New query condition (a list). See ade_qrydefine. |
This function affects the current query.
You cannot alter grouping with this function. Any grouping you specify is ignored. To group or ungroup, use ade_qrygroup or ade_qryungroup.
The following sample defines a query using ade_qrydefine(). A resbuf is created which contains the replacement query condition. This resbuf and the query condition id returned by ade_qrydefine() are used as parameters to ade_qrysetcond(). The value returned by ade_qrysetcond() is checked against RTNORM and an appropriate message is displayed. The resbuf is then released as required.
char* pszJoinOperator = ""; // none
char* pszBgnCondGrouping = ""; // none
char* pszNotOperator = ""; // none
char* pszCondType = "Property";
char* pszEndCondGrouping = ""; // none
struct resbuf* pQueryConditionRb = acutBuildList(
RTLB,
RTSTR, "layer",
RTSTR, "=",
RTSTR, "Pond",
RTLE,
0 );
ade_id queryCondId = ade_qrydefine(
pszJoinOperator,
pszBgnCondGrouping,
pszNotOperator,
pszCondType,
pQueryConditionRb,
pszEndCondGrouping);
if (queryCondId != ADE_NULLID) {
struct resbuf* pSetQueryConditionRb = acutBuildList(
RTLB,
RTSTR, "",//joinop
RTSTR, "",//bggroups
RTSTR, "",//not_op
RTSTR, "property",
RTLB,
RTSTR, "layer",
RTSTR, "=",
RTSTR, "Water",
RTLE,
RTLE,
0 );
int returnCode = ade_qrysetcond(queryCondId, pSetQueryConditionRb);
if (RTNORM == returnCode) {
acutPrintf(
"\nThe query condition has been modified.");
}
else {
acutPrintf(
"\nThe query condition has not been modified.");
}
acutRelRb(pQueryConditionRb);
acutRelRb(pSetQueryConditionRb);
}


