## Accessing a Report's Object Properties

PC-DMIS versions 4.0 and above support the ability to create your own custom report and label templates which PC-DMIS uses to display report data inside a Report window (see View | Report Window). These templates are created using template editors which utilize a Visual Basic-like interface which lets you insert, relocate, and size special components called "objects".

Each object consists of "properties" that define how it will be displayed and what information it holds. Some of these properties are in common with all other objects, some are in common with only related objects, and others are unique to that specific object.

The PC-DMIS Expression Language can query the current loaded Report and store property values of a particular object in a variable. It can obtain values of type String, Integer, and Real by using this syntax:

Property Query Syntax

Assign/V1 = Report.<Object Name>.<Property Name>

Report is a reference to the currently loaded report. <Object Name> is the object's unique name and <Property Name> is a valid property name for that object.

A Simple Example

Suppose, for example, that your report template has a text object called "Text1" that you want to use in the final report to display the operator's name. The actual string of characters representing the operator's name will be stored in the Text property of the object. By default, the text property (displayed text) initially has the value of "Text1" (see the figure below). Because this is a user-assigned property, this will change when the operator types in the name during execution.

Properties dialog box, showing a selected object and the property to query

To use the Expression Language code to query this Text object's "Text" property and obtain the keyed-in data, you would use the following command:

Assign/V1 = Report.Text1.Text

In this code, "Report" tells the code to look at the report loaded in the Report window. "Text1" tells it to look for the object named "Text1". "Text" tells it to look for the "Text" property within that object. The value of the "Text" property then gets passed into the V1 variable which you could then further manipulate or display using the PC-DMIS Expression Language.

Finding Properties

You can find what properties are associated with a particular object by accessing the Report template in the Report template editor (File | Reporting | Edit | Report Template), selecting the object, and then right-clicking on the object to display its property sheet.

The property sheet for a Text object

The property sheet contains two columns. The left column displays the property name, and the right column displays the current value. Be sure to use the exact property name in your expression code.

Important: When querying property values, you may find that some properties return a seemingly useless numerical value. Generally this happens when the property has a set list of available options, and PC-DMIS returns an internal value for the selected property that doesn't relate to the displayed property.
For example, the Text object has an Orientation property with these values:
0 - Horizontal
1 - Vertical up
2 - Vertical down
However, if you obtain the value using PC-DMIS expression language, the software will instead return the following:
0 (for Horizontal)
900 (for Vertical up)
-900 (for Vertical down)
It may require some trial and error to determine what returned values correspond with the value displayed on the property sheet.