Skip to main content

Tips & Tricks: Checking whether an Object is there

In any application, there are always central functions which control a generic process. These functions request reporting-specific functions from the central area. If, for example, a report only requests data when needed, but is supposed to be directly updated when a favorite is activated, the update must be triggered by the central document.

Here, the problem arises that there may also be reports which are always up to date. In this case, the central function must not activate the button for manual update because this would not exist in this report. Thus, there would be an error report.

Avoid error messages with a dynamic check

One solution for this problem is the maintenance of a control table in a database which contains information on when a manual update is necessary or sensible. In the course of the update of the report, this information could then be requested. However, the efforts to maintain this information are relatively high. The functionality and also the possibility to evaluate reports are in place despite the efforts and the susceptibility to error. However, it is more elegant to use a dynamic assessment of whether an object exists. arcplan does not provide a function to do so. The assessment can be done with the following formula, however:


This formula identifies the object with the name <Report_Update_Button> from the report <ReportName>. If this object does not exist, the assessment with ISEMPTY will return a “1”, otherwise a “0”.

It is important in this context that the function ISEMPTY() naturally evaluates the contents of an object. In the example of the update, the object to be assessed is a button. The content of a button is the text which is stored in the “Issue” characteristic (the labeling) of the button. Thus, this must not be empty. Thus, the same applies to all other object, , as well: an assessment can only work if there is content.

Why an alternative formula does not work permanently

An assessment of whether an object is empty or not is frequently also done with the following construction:

OBJECT([<Report_Update_Button>];[<ReportName>]) = EMPTY()

This kind of assessment, however, does not work for the case described here, as an “= EMPTY()” can only be applied to objects with the “calculate event”. Thus, only the formula stated at the beginning should be used for the assessment.