Submitted by alla on Thu, 11/25/2010 - 15:52

Tracing Data Origin | Table of Contents | Commands Execution >

As described in previous sections, MagicTree allows a user to execute a sequence of XPath expression. Table View queries are executed row by row, each subsequent row gets executed in the context of a node returned by a previous row. Report generation has introduced a concept of "scopes" and each expression gets evaluated in the context of a node returned by XPath expression of the parent scope.

Standard syntax XPath syntax, ".", can be used to refer to the current node, which effectively is the node returned by previous XPath expression. Additionally, there is a way to refer to nodes further in the past, by explicitly specifying its "level" using $_LEVEL syntax, where LEVEL is an integer. In Table View LEVEL is a row number, starting from 0. In report templates, LEVEL indicates "depth" of the scope which needs to be addressed. $_0 variable will address the value returned by XPath expression in the very top scope.

Probably the most useful application of this feature is grouping. Consider example below (you can load it from the RepoBrowser if you search for "findings" and specify Type=Query and Repo=User).



Query Utilizing Back Reference Variables


This query will produce a table containing all findings, grouped by severity. For each finding the table will contain a list of nodes affected by the finding.

Tracing Data Origin | Table of Contents | Commands Execution >

Contacts

+32 (0) 2 215 53 58

Gremwell BVBA
Sint-Katherinastraat 24
1742 Ternat
Belgium
VAT: BE 0821.897.133.