Skip to content

DISCARD_MODEL ​

DISCARD_MODEL removes a model that has previously been loaded with <LOAD_MODEL> from the core.

Syntax ​

leo-grammar
CC "Core" DISCARD_MODEL model:idValue

#-->RESULT ecode:intValue
CC "Core" DISCARD_MODEL model:idValue

#-->RESULT ecode:intValue

Parameters ​

  • modelid (idValue) - the id of the model that should be loaded

Returns ​

  • ecode (intValue) - Contains the error code or is 0 in case of success.

Details ​

All changes that have been made to the model since it was loaded are lost unless they are saved to the database with <SAVE_MODEL> prior to calling DISCARD_MODEL.

Every model which is created or loaded via the "Core" MessagePort has to be discarded using DISCARD_MODEL or opened in the model editor with CREATE_WINDOW_FOR_LOADED_MODEL. If it is not discarded, the user will not be able to open it later in the model editor.

Models that have been opened in the model editor must not be closed with the DISCARD_MODEL command. Use the "Modeling" MessagePort command CLOSE instead.

See Also ​

LOAD_MODEL
SAVE_MODEL
CREATE_WINDOW_FOR_LOADED_MODEL
CLOSE

Examples ​

asc
CC "CoreUI" MODEL_SELECT_BOX 

CC "Core" LOAD_MODEL modelid:(VAL modelids)

CC "AdoScript" INFOBOX "Now the model is loaded but not visible..."
# here we can access model information with Core commands

CC "Core" DISCARD_MODEL modelid:(VAL modelids)
CC "CoreUI" MODEL_SELECT_BOX 

CC "Core" LOAD_MODEL modelid:(VAL modelids)

CC "AdoScript" INFOBOX "Now the model is loaded but not visible..."
# here we can access model information with Core commands

CC "Core" DISCARD_MODEL modelid:(VAL modelids)

Lets the user select a model. Loads the model to the core and then discards the model again.

Versions and Changes ​

Available since ADOxx 1.3