Check if an object definition existsTag(s): Powerscript


For user object or window
ClassDefinition cd_dwo

cd_dwo = FindClassDefinition(as_objectname2check)

IF IsNull(cd_dwo) THEN
   MessageBox("Error", as_objectname2check &
     + " is not present in the present Library List!")
END IF
For datawindow
datastore lds_temp

lds_temp = CREATE datastore
lds_temp.dataobject = as_objectname2check

IF NOT IsValid(lds_temp.Object) THEN
   MessageBox("Error", "The datawindow "&
     + as_objectname2check + " does not exist!")
END IF

In PB8, the new try/catch can be used to detect missing objects.

TRY
open (w_missing_window)
CATCH (runtimeerror EX)
  MessageBox("Error","Window missing....")
  RETURN -1
END TRY

blog comments powered by Disqus