dbDeleteObject behavior in openAccess

S

SS

Guest
I have a code which would delete some shapes in the layout view if
they a "certain" property attached to it.
I use dbDeleteObject to delete them . However dbDeleteObject deletes
some child objects while deleting parent objects.

This causes the code to error out (as it tries to delete already
deleted objects).

I therefore introduced a check to see if the object exists before
deleting.

This is how I do it.
if(obj the
printf("the obj is %L\n" obj)
if(dbGetPropByName(obj "placed") != nil then
dbDeleteObject(obj)
)
dbSave(cvId)
)


Howver it prints the object ID (using the print statement) but errors
out after that saying the object does'nt exist.

Wyy is this happenning ?

-SS
 
I believe you can use dbIsObj() to test wether the object is valid prior to delete it.

You can also have a look at errset() to catch errors.

cheers,
Stéphane


SS wrote:
I have a code which would delete some shapes in the layout view if
they a "certain" property attached to it.
I use dbDeleteObject to delete them . However dbDeleteObject deletes
some child objects while deleting parent objects.

This causes the code to error out (as it tries to delete already
deleted objects).

I therefore introduced a check to see if the object exists before
deleting.

This is how I do it.
if(obj the
printf("the obj is %L\n" obj)
if(dbGetPropByName(obj "placed") != nil then
dbDeleteObject(obj)
)
dbSave(cvId)
)


Howver it prints the object ID (using the print statement) but errors
out after that saying the object does'nt exist.

Wyy is this happenning ?

-SS
 

Welcome to EDABoard.com

Sponsor

Back
Top