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


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.
  • Included in reports
  • Can be inter-dispersed with text in a report to enhance readability
  • Not editable
  • Must fit into the width of a printed page
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.
  • Excel-like matrixes that can be generated from data in SystemWeaver
  • Provides a good overview of information
  • Ability to filter, sort and group data as needed
  • Can be exported to Excel or CSV
  • Can be scrolled in a window


Examples of Tables and Grids and Their Definitions

Table
Grid
<Report>
<Table>
<Columns>
<ItemNameColumn objectName="component" caption="Component" width="200"/>
<ItemNameColumn caption="Requirement" width="200"/>
<ItemAttributeColumn caption="Prio" type="PRIO"/>
<ItemAttributeColumn caption="Verification Method" width="100" type="ABVM"/>
<DescriptionColumn/>
</Columns>
<ForEachPart type="XESX">
<DefObj>
<ForEachPart type="EXAC">
<DefObj>
<RowObject name="component">
<ForEachPart type="IBAR">
<DefObj>
<Row/>
</DefObj>
</ForEachPart>
</RowObject>
</DefObj>
</ForEachPart>
</DefObj>
</ForEachPart>
</Table>
</Report>
<Grid>
<Options>
<CellAutoHeight/>
</Options>
<Columns>
<ItemNameColumn objectName="component" caption="Component" width="200"/>
<ItemNameColumn caption="Requirement" width="200"/>
<ItemAttributeColumn caption="Prio" type="PRIO"/>
<ItemAttributeColumn caption="Verification Method" width="100" type="ABVM"/>
<DescriptionColumn/>
</Columns>
<ForEachPart type="XESX">
<DefObj>
<ForEachPart type="EXAC">
<DefObj>
<RowObject name="component">
<ForEachPart type="IBAR">
<DefObj>
<Row/>
</DefObj>
</ForEachPart>
</RowObject>
</DefObj>
</ForEachPart>
</DefObj>
</ForEachPart>
</Grid>



Bildresultat för exercise icon freeExercise 1

  1. Open Item: x0400000000000292.
  2. 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.



Bildresultat f�¶r exercise icon freeExercise 2

  1. Using Exercise 1 as a starting point for the Vehicle Architecture, remove the <ItemNameColumn> for Requirement.
  2. 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. 


Bildresultat f�¶r exercise icon freeExercise 3

  1. Open item: x0400000000000292.
  2. For the Vehicle Architecture tree, create a Grid that lists the names of all Application Components. Generate a new row based on the component.
  3. 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.
  4. 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. 


Bildresultat f�¶r exercise icon freeExercise 4


  1. Open item: x0400000000000292.
  2. 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.
  3. 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.