Checking for null values prePrint

Posted in: - Jun 27, 2012 No Comments

This example provides a generic solution that loops through a page and if all of the objects are null, then it will not print that page. If any of the objects have a value, then the page will be printed.

Again, this demonstrates the advantages of using a function (in a script object), which contains the main script. The function is called from the prePrint event of each page. Note that we are passing two variables into the function, which are both the same (eg page1). This is because if the page contains subforms we want to call the function recursively. When this happens the variables passed to the function will be the name of the subform and the original pageReference. This way we can still hide the page, respective of where the function is called from.

The script object and function are:

AssureDynamics.CheckForNull(myParentObject, pageReference); 

This would be called as:

AssureDynamics.CheckForNull(page1, page1);

If page1 contained a subform (eg called subform1), then the function could be automatically called recursively as:

AssureDynamics.CheckForNull(subform1, page1);

Check out this example, which includes a screenshot explaining script objects and functions.

This example has been extended, so that it not does not test objects, whose name begins with DONOTTEST. See Revision 1 of the form, as linked below.

Download: Assure Dynamics Check for null on prePrint (Rev 1)

No Responses to “Checking for null values prePrint”

Leave a Reply

You must be logged in to post a comment.