Overview
This training material expands on previously existing knowledge of grids and tables by combining it with the SystemWeaver Path Query Language.
Course Type
Suitable for class training or for self study.
Course Length
Two hours to half-day course.
Prerequisites
- Completed the SystemWeaver Report Generation - Introductory Training.
- Completed the Tables and Grids - Introductory Training.
- Completed the SystemWeaver Path Query Language Training.
- Familiarity with SystemWeaver concepts such as Items, Parts and Attributes, and also with the GUI and common operations of the swExplorer.
- Knowledge of XML.
- An installation of the SystemWeaver client (swExplorer).
- A training server (If the course leader has not set up a server for the class, you can set up your own server by following the instructions in Setting up a Test Server).
- An installation of the Script Language Training sqlite training database. See Database for Script Language Training.
Exercises
The answers to all exercises in this article can be found on the Script Training>Answers ribbon tab:
Introduction
In the prerequisite training material, the basic functionality of these views has been presented using the script language. However, combining this knowledge with the SPaQL creates new possibilities for more complexity. This course aims to present some of the possibilities where using the SPaQL provides a different approach to the problem. In other words, there will be very little new material presented in this course and instead it will focus on combining previous knowledge with a different aspect of SystemWeaver.
Looking Back on Tables and Grids
When working with Tables and Grids in the previous material, it became apparent that tables and grids are in many ways interchangeable. One example described how one could even copy and paste identical code into one or the other by just swapping out the initial tags. Some of the functionality differed, however, and is presented in the table below.
Table | Grid |
---|---|
Tables exist for the purpose of formatting data in reports and documents for review and/or printing.
| Grids exist to give you an overview of the data and enable you to sort and filter that information. Also, it is possible to export data to Excel.
|
Examples of Tables and Grids and Their Definitions
Exercise 1
- Open Item: x0400000000000292.
- For the Vehicle Architecture tree, rewrite one of the above examples using the SystemWeaver Path Query Language.
Using the Path Query Language with Tables and Grids
As described in SystemWeaver Path Query Language, it is possible to use the Path Query Language in the reports sandbox #{? 'Expression here'} syntax inside a <Text> field. The same thing is possible in a grid or table when using a TextColumn with the <Value> operator. For additional information on textcolumns, please see the SystemWeaver Help Manual.
Exercise 2
- Using Exercise 1 as a starting point for the Vehicle Architecture, remove the <ItemNameColumn> for Requirement.
- Create a <TextColumn> that fulfills the same task as the ItemNameColumn previously did.
The result should be identical.
Tip: Using the cellMerge or autoMerge function will get rid of duplicate cells.
Navigating the Structure
So far, we have been working with a strict top-down structure when using grids and tables. This makes it easy to generate rows based on the last item and the result will be a structured grid much like the one in the exercises above. However, at times there might be a need to navigate the structure further or to go in many different directions from the main object. Earlier, we have used RowObjects to be able to access data further up in the tree and we have continued to navigate down through a set path.
Using the <TextColumn> and the <Value> tags together with the SPaQL opens up new possibilities where we can continue down into the structure to access information that would have otherwise been inaccessible using the standardized columns with a predefined behavior. Inside the <Value> tag, one can use the #{? 'Expression here'} syntax to access the Path Query Language to follow one or several paths, i.e., #{? /ASID.Select(Name)} lets us follow the part SID (ASID) to access all item names that share this part.
Exercise 3
- Open item: x0400000000000292.
- For the Vehicle Architecture tree, create a Grid that lists the names of all Application Components. Generate a new row based on the component.
- Create one column for each subitemtype and generate the names of each of these connected to the component. Each subitem should be represented on a new line, but can be located within the same cell.
- If there isn't an item, then the cell should be blank.
Expected result:
Tip: Use the NewLine operator.
Adding Conditions
Using the Path Query Language, it is possible to add multiple conditions using the [ ] operator as was shown in the SystemWeaver Path Query Language training using the following examples. This operator is active on lists and the conditions will filter the list and create a new list for each condition.
Example 1
Return all requirements found below the application components whose Priority attribute (SID=PRIO) equals 1.
Example 2
Returns all application components that have more than one requirement.
Using the [ ] can be quite costly to the prestanda of the view and should be used with a clear goal in mind. An alternative to the [ ] operator is using the and-operator instead which operates on one list instead of creating new lists based on filters. Again, it depends on what the intended result is and what prestanda one hopes to achieve.
Exercise 4
- Open item: x0400000000000292.
- For the Vehicle Architecture tree, create a Grid that lists the names of all Application Components that have an E2E function and at least two requirements. Generate a new row based on the component.
- List the E2E functions and Requirements in a seperate columns.
Note: Using the Path Query Language and conditions inside a <TextColumn> is possible, but it won't always result in the optimal or intended solution. Placing conditions inside the path itself might be much more effective.