Steps to Set DataObject Exceptions

Why use this tutorial?

When Visual Expert analyses your code, some references to dataobjects may be missing.

This may happen in the case of indirect references:
For instance, when passing dataobjects as parameters, or creating variables to store dataobjects name to manipulate them later via this variable.
In such cases, Visual Expert cannot “guess” that a certain parameter is in fact a dataobject, or that a certain string is a dataobject name.

This tutorial will show you how to declare “exceptions”, to instruct Visual Expert how to identify these dataobject and find the missing references.

How to Set DataObject Exceptions in Visual Expert?

Step 1: Identify Missing References

You should identify those dataobjects/datawindows that have no reference yet, although they are used as mentioned above.

  • For instance, you can select the root of the DataWindows in the Visual Expert tree view and click on [Possibly Unused Objects].
    Select the root of DataWindows
  • Alternatively, you can check a particular PBL:
    Select this PBL in the tree view and click on [Possibly Unused Objects].

    All DataWindows/DataObjects listed here have no references for now.
    If some of them are indeed used via function parameters and/or variables, follow step 2.
    Possibly Unused Objects in Visual Expert

Step 2: Create DataObjects Exceptions

Anytime a datawindow is wrongfully listed as 'unused', declare a “Set DataObject Exception”.

  • Go to [Settings - More Settings]
    More Settings in VE
  • Go to [Project – Exceptions] and click on the [Add] button.
    Select “Set DataObject Exception”.
    Set DataObject Exception
  • Enter the details of the DataObject Exception:
    • Type of Item raising the exception:
      For instance a custom Function with a dataobject name passed as parameter.
      Select Custom or System attribute in the case of variable containing a dataobject name.
      Enter Details for DataObject Exception
    • Browse your code to select the corresponding function or variable.
      Note: In case of a function defined in a function object, select the 'Function Object' before selecting the function.
      Select Function Object in Visual Expert
    • For a function, select a parameter passing the datawindow name.
      Select DataWindow Parameter in Visual Expert
    • Save your changes. The new exception appears in the exception list.
      Save New DataObject Exception in Visual Expert

Step 3: Update your Code Analysis

  • Close the 'Settings' window. Visual Expert will suggest to refresh your Code Analysis.
  • Click [Yes]. The code parsers will then take your exception into account.
    Set DataObject Exception
  • New references to DataWindows are now added. The corresponding DataWindows are no longer listed as “unused”.
    New References Added to DataWindows


Visual Expert 2021, Getting Started, Configuration & Settings, Code Parser, PowerBuilder