Please ensure Javascript is enabled for purposes of website accessibility
Powered by Zoomin Software. For more details please contactZoomin

RtReports

Source expressions in dynamic drawing elements

  • Last UpdatedJan 24, 2023
  • 2 minute read

Dynamic drawing elements in the format template use source expressions to define the location of the information they gather from the data journal.

A source expression is an XPath (XML Path) query that navigates the nodes of the XML file for the data journal and extracts the correct information for the report. The location of the data journal information can be either a relative or absolute path.

For more information about XPath syntax and functions, see Microsoft's XPath Reference page.

You define source expressions in the Source field when editing the dynamic drawing element. You populate the Source property in one of two ways:

  • Click the data journal Journal tab, navigate to the element, then drag and drop it into the Source field in the dynamic drawing element Edit window. RtReports editor automatically populates the source expression.

  • Manually construct the source expression.

The context of the source expression determines how RtReports queries the data journal. Because the data journal is arranged in a tree hierarchy, querying the entire tree will return a different result set than only querying one branch of the data journal's tree hierarchy.

Drag and drop elements into the Source field

In this example, we want to add the PIUnitName element of the UnitBatchJournal to the report.

  1. Add a data drawing element to the format template.

  2. Switch to the Journal pane, navigate to the first UnitBatchJournal, and select the PIUnitName element.

  3. Drag and drop the PIUnitName element into the Source field.

Source expression syntax

For source expressions that require more complexity, you will need to manually edit the expression.

Source expressions:

  • Use a path notation, like those used in URLs, for locating parts of the data journal.

  • Query the data journal to locate elements that are boolean, number, or string types.

  • Can have predicates, called filter expressions, or function calls.

  • Can match specific patterns at one particular context.

  • Can rerun results.

  • Perform additional operations based on the context of the results.

    Source expression operators and special characters

    Operator

    Effect

    /

    Child operator; selects the immediate children

    @

    Attribute; prefix for an attribute name

    ( )

    Groups operations to explicitly establish precedence

    [ ]

    Applies a filter pattern

Source expression examples

  • The expression BatchJournal/JournalEvents/JournalEvent will return all existing JournalEvent elements contained in the JournalEvents element.

  • The expression UnitBatchJournal[@Name=”Unit1”] refers to all UnitBatchJournal elements whose Name attribute is set to “Unit1”.

  • To extract the PIUnitName element for a UnitBatchJournal, the syntax would be:

    BatchJournal/UnitBatchJournals/UnitBatchJournal/PIUnitName

  • To extract the PIUnitName element for a UnitBatchJournal that contains the PIUnitName = “TRA100L,” the syntax would be:

    BatchJournal/UnitBatchJournals/UnitBatchJournal[Name=”TRA100L”]/PIUnitName

TitleResults for “How to create a CRG?”Also Available in