ade_odmodifytab

Land Desktop Development ARX CPP SDK

Up a level
ade_odmodifytab
 
 

Redefines a table.

int

ade_odmodifytab(

struct resbuf* tab_defn);

Returns RTNORM or an error code.

tab_defn List of table elements: the name of the table you will redefine, a new table description, and a sequence of new field definitions.

The tab_defn argument has the same format as the tab_defn argument in ade_oddefinetab. The entry for this function has source code examples.

For the table you specify in the tab_defn argument, the function replaces the existing table definition with the new one. For every object to which the table is attached, the corresponding fields of each record of the table are replaced. The old fields are deleted, and the new fields are assigned default values in accord with their field definitions.

The ade_odmodifyfield function affects all active drawings in the drawing set. There should not be any queried objects for this operation.

Note  This function will not operate unless your end user has superuser privileges.

The following sample creates a resbuf containing the updated table defenition. ade_odmodifytab() uses this resbuf and returns a result code indicating a successful operation. Then it releases the resbuf, as required.

struct resbuf* pOdTableModRb = acutBuildList(
    RTLB,
        RTSTR, "tablename", RTSTR, "table1",
    RTDOTE,
    RTLB,
        RTSTR, "tabledesc", RTSTR, "New Sample Table",
    RTDOTE,
    RTLB,
        RTSTR, "columns",
        RTLB,
            RTLB,
                RTSTR, "colname", RTSTR, "field1",
            RTDOTE,
            RTLB,
                RTSTR, "coldesc", RTSTR, "Field 1 column Description",
            RTDOTE,
            RTLB,
                RTSTR, "coltype", RTSTR, "character",
            RTDOTE,
            RTLB,
                RTSTR, "defaultval", RTSTR, "Default Value",
            RTDOTE,
        RTLE,
    RTLE,
    0);
int nResultCode = ade_odmodifytab (pOdTableModRb);
if (RTNORM == nResultCode) {
    acutPrintf(
        "\nThe specified table has been successfully modified.");
}
else {
    acutPrintf(
        "\nThe specified table has not been modified.");
}
acutRelRb(pOdTableModRb);