4 Component Editor
Transmission Line
6.8. Advanced Queries
6.8.2. Changing Boolean Operator Precedence
If condition lines are connected with only one type of Boolean operator, the query proceeds sequentially though the component set, resolving each Boolean operator before continuing to the next. For instance, if a component set contains condition lines 1 AND 2 AND 3, PTW resolves the first AND first, and then the second. For Boolean operators of a common type, this sequence makes no difference. However, when you combine different types of Boolean operators in the same component set, PTW must prioritize them. By default PTW resolves AND Boolean operators before OR Boolean operators. This sequence of priority is referred to as Boolean operator precedence: the AND Boolean operator takes precedence over the OR Boolean operator.
You can change the default Boolean precedence by grouping condition lines together using parentheses in the query definition. This imposes an internal structure on a component set, telling PTW how to resolve the query. Changing the Boolean operator precedence can dramatically affect the retrieved component list.
To get an understanding of how changing precedence can affect the results of a query, look at the following equations:
3+2×5 = 13 (3+2)×5 = 25
Notice that while the number to the left of the equal sign remains constant, the sequence in which the operations are performed has been changed by grouping operations in
parentheses, yielding significantly different results. Queries resolve themselves just like equations: they resolve the innermost set of parentheses first, and work their way to the outermost set. Let’s rewrite the equations above in terms of a query:
1 OR 2 AND 3 (1 OR 2) AND 3
In these queries, 1, 2 and 3 are condition lines. Because there is no differentiation in the first query, PTW follows the precedence default and resolves the AND Boolean operator first. Thus it retrieves all components that have both 2 AND 3, OR all components that have 1. In the second equation, the parentheses reverse the default precedence order, and the query retrieves all components that have 1 OR 2 AND all components that have 3.
Note: To create a valid group, you must be sure to insert parentheses in pairs. That is, for each open parenthesis “(” you must include a close parenthesis “)”. Each close parenthesis closes the nearest available open parenthesis. You can also nest parentheses, creating several levels of Boolean operations.
To change Boolean operator precedence
1. Define or edit a query that includes all of the condition lines you want, with the proper Boolean operators.
2. In the query definition box, select the condition line above which you want to insert the open parenthesis.
3. Click the “(” button. An open parenthesis appears above the selected condition line. To change Boolean operator precedence, use the
4. In the query definition box, select the condition line above which you want to insert the close parenthesis.
5. Click the “)” button. A close parenthesis appears below the selected condition line. As an illustration, say that you want to retrieve a list of DT or OAFA two-winding transformers with a nominal kVA between 50 and 100. If you create the query with all the proper Boolean operators, the query definition looks like this:
SELECT 2-Winding Transformer WHERE ( Key = ONAF OR Key = DT AND NomSize >= 50 AND NomSize <= 100 )
In this query, the AND Boolean operators take precedence by default so PTW resolves the first AND, proceeds to the second AND, and then finishes with the OR. As a result, this query retrieves all ONAF two-winding transformers and all DT two-winding transformers with a nominal kVA between 50 and 100. To correct the problem, the condition lines have to be grouped as follows:
SELECT 2-Winding Transformer WHERE ( ( Key = ONAF OR Key = DT ) AND ( NomSize >= 50 AND NomSize <= 100 ) )
The query now resolves the Boolean operators within the parentheses first, which determines the transformer type and the nominal size. Only then does it resolve the AND Boolean operator between the parentheses, giving us the results we want.
By default, the only group in the query definition encloses the entire component set.
Adding parentheses establishes the proper Boolean operator precedence.
7 Reports
Reports are ASCII text files that can contain a variety of information such as Study results, input data, schedule documentation, or your own notes about a project. You can use PTW’s Report Editor to view, edit and print existing Reports, or to create blank Reports for your own notes. Using advanced features of the Report Viewer, you can cut and paste text among Reports, change the font size, search and replace text, and much more. Use the Reports to store numerous Study scenarios, to create presentation or proposal prototypes, or just to keep your thoughts and comments on the computer in a form that you can retrieve easily.
Studies automatically generate Reports every time you run them, based on the Report file name you provide. For information on running Studies, refer to the Reference Manual for that Study.
This chapter discusses: • What is a Report?
• Creating and opening Reports. • Editing Reports.
• Changing Report options such as color, word-wrap, and font size. • Opening Reports in other applications.
IN THIS CHAPTER
7.1. What is a Report? ... 7-2 7.2. Creating and Opening Reports... 7-2 7.3. The Report Interface ... 7-3 7.4. Navigating the Report... 7-4 7.5. Working with Text... 7-5 7.6. Setting Report Options ... 7-7 7.7. Opening Reports in Other Applications... 7-8 7.8. Crystal Reports ... 7-9