DropLayerFromWorkspace()

Summary

Removes a layer from an application.

Changes

From Version 5.0 drops any associated node layer.

Syntax

DropLayerFromWorkspace(string layer_name)

Argument Contents
layer_name The layer to be dropped

Notes

  • If the layer appears in any map or editor, or if it is part of a joined view, it cannot be dropped with DropLayerFromWorkspace().

  • DropLayerFromWorkspace() drops any associated node layer.

Example

lyr = AddLayerToWorkspace("Counties", "cccntyl.cdf", "County (Low Res)")
nrecs = GetRecordCount(lyr)
DropLayerFromWorkspace(lyr)
ShowMessage("There are " + String(nrecs) + " counties.")

Error Codes

Error Type Meaning
Error The layer is in use, and cannot be dropped
NotFound The specified layer does not exist

See Also

Function Summary
AddLayerToWorkspace() Adds a layer to an application without it appearing in a map or dataview
DropLayer() Removes a layer from a map