ade_qlgetctgyinfo

Land Desktop Development ARX CPP SDK

Up a level
ade_qlgetctgyinfo
 
 

Gets information about a query category.

struct resbuf*

ade_qlgetctgyinfo(

ade_id ctg_id,

char* info);

Returns the requested information or NULL.

ctgy_id Category ID.
info Type of category information to get: "name" to get the category name, or "qrylist" to get a list of query IDs of the queries in the category.

You must release the resbuf.

The information returned depends on the info argument you use, but it is always in list format. For example:

The following sample populates a resbuf with query category id's using ade_qllistctgy(). This resbuf is then used by ade_qlgetctgyinfo() to populate a resbuf containing category names or category id's depending on the value of info. The switch case statement prints the appropriate information, (category names or query Id's). Then it releases the resbuf, as required.

struct resbuf* pQryCtgryRb = NULL;
char* pszCategoryInfo = "qrylist";
struct resbuf* pQryCtgryId = ade_qllistctgy();
if(pQryCtgryId != NULL) {
    struct resbuf* rb = pQryCtgryId;
    while(rb != NULL) {
        pQryCtgryRb = ade_qlgetctgyinfo(rb->resval.rreal, pszCategoryInfo);
        if(pQryCtgryRb != NULL) {
            switch(pQryCtgryRb->restype)
            {
                case RTREAL:
                    acutPrintf(
                        "\nThe %s option you've specified produced the following query category id: %.0lf"
                        , pszCategoryInfo, pQryCtgryRb->resval.rreal);
                    break;
                case RTSTR:
                    acutPrintf(
                        "\nThe %s option you've specified produced the following query category name: %s"
                        , pszCategoryInfo, pQryCtgryRb->resval.rstring);
                    break;
                default:
                    acutPrintf(
                        "\nCould not determine the value");
                    break;
            }
        }
        rb = rb->rbnext;
    }
}
else
{
    acutPrintf(
        "\nThe %s category you've requested produced no information"
        , pszCategoryInfo);
}
acutRelRb(pQryCtgryId);
acutRelRb(pQryCtgryRb);