ade_rtdefrange

Land Desktop Development ARX CPP SDK

Up a level
ade_rtdefrange
 
 

Defines a range table.

ade_id

ade_rtdefrange(

char* tabname,

char* description,

struct resbuf* range_defn);

Returns a range table ID or ADE_NULLID.

tabname Range table name; can be up to 31 characters long. Must be unique, contain no spaces, and start with an alphanumeric character.
description Range table description.
range_defn Range table definition.

A range table allows you to alter properties of queried entities conditionally. It contains a set of property alteration values from which a single value is selected depending on conditions obtaining in the queried entity to be altered.

The range_defn argument is a range table definition, a list of range expressions. Each range expression includes (1) a condition and (2) a property alteration value to return if the condition is true. This information is expressed as a list of three elements: a range table operator and a comparison value (which together make up the condition), and the return value. You must state each value explicitly. You cannot substitute an expression.

See Using a Range Table for more information.

The following sample creates a resbuf containing the range expression values representing the table defenition. ade_rtdefrange() is called with all required parameters, the returned rangeTableId is checked for ADE_NULLID and an appropriate message is displayed. Then it releases the resbuf, as required.

char* pszrRangeTblName = "Range_ChgColor";
char* pszrRangeTblDesc = "Change all except red to yellow";
struct resbuf* pRangeTblDef = acutBuildList(
                                RTLB,
                                RTLB,
                                    RTSTR, "=",
                                    RTSTR, "1",
                                    RTSTR, "1",
                                RTLE,
                                RTLB,
                                    RTSTR, "OTHERWISE",
                                    RTSTR, "",
                                    RTSTR, "2",
                                RTLE,
                                RTLE, 0);

ade_id rangeTableId = ade_rtdefrange(pszrRangeTblName, pszrRangeTblDesc, pRangeTblDef);
if (rangeTableId != ADE_NULLID) {
    acutPrintf(
        "\nThe range table %s has been created."
        ,pszrRangeTblName);
}
else {
    acutPrintf(
        "\nNo range table has been created.");
}
acutRelRb(pRangeTblDef);