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

RtReports

Condition expressions in dynamic drawing elements

  • Last UpdatedJan 24, 2023
  • 3 minute read

You can use conditional formatting based on the value of the data within the report. For example, if you are creating a manufacturing exception report, and you want the values for exceptions to be red, or use a different font, you use condition expressions within format elements to change the formatting for these values.

Condition expressions use the same syntax as source expressions.

You specify a source expression, which finds an element or group of elements within the data journal, and then place a Boolean operator around it. If the Boolean operator returns a TRUE value, then the format element is included in the final rendered report. If the Boolean operator returns a FALSE value, then the format element is not included in the final report.

Dynamically change report formatting

In this example, you change the formatting of objects based on their values. If a string value is FAILED, the value in the report will be red. No other values use special formatting.

  1. Add a data object to the format template and specify the Source location to the string value result, for example, Result\Result\Value.

  2. Add another data element to the format template and set the Source location to the same source expression as the previously added data element.

  3. Select the first conditional Data object, right-click and select Property. In the Condition field, enter:

    Boolean(Result/Result[Value="FAILED"])

    not(Boolean(Results/Result[Value="FAILED"]))

    This expression will return TRUE if there are results which have a value of FAILED.

  4. Change the font color of the conditional text to red. Click OK.

  5. Edit the second data element. In the Condition field, enter:

    not(Boolean(Results/Result[Value="FAILED"]))

    and click OK.

    This condition expression returns TRUE if no result has a value of FAILED.

  6. Refresh the report.

Show additional elements for exception conditions

In this example, you create a table to display normal data and exception data. To do this, you must search each JournalEvent for exception conditions. If a JournalEvent represents an exception condition, you will show extra elements in the table, such as the violation value. The condition expressions will be added to the elements contained within the exception columns.

  1. Add a table element to the report.

  2. In the table element, insert two table row elements, and insert six table data elements into each table row element.

  3. Insert text elements in each of the table data elements in the first table row element. Name them: DataSource, Hourly Average, Start Time, End Time, Exception Value, and Exception Time.

  4. In the second table row element, right-click and select Property, then enter the iterator expression:

    JournalEvents/JournalEvent/SequenceEntries/JournalEntry

    in the Iterator field.

    The first four columns will contain data that is common throughout all action states.

  5. Add dynamic drawing elements to each of the four table data elements in the second table row element. For example, the source expressions should be similar to the following:

    DataSource column: Parameters/Parameter[Name="DataSource"]

    Hourly Average column: Results/Result[Label='Summary']/Value/TraceSet/Events/Properties/Property[(@Descriptor='24005')]

    Start Time: StartTime

    End Time: EndTime

  6. In the fifth table data element in the second table row element, insert a data element and set the source expression to the Violation result. For example:

    Results/Result[Label='StartStateValue']/Value/TraceSet/Events/Properties/Property[(@Descriptor='24000')]

  7. Add the condition expression to check if the Violation result exists.

    Not(Boolean(Results/Result[Label='Message'and(Value='OK')]))

    If the result exists, it will be shown. Otherwise, the column will be empty.

  8. In the sixth table data element in the second table row element, insert a data element and set the source expression to the Violation time result. For example:

    Results/Result[Label='StartStateValue']/Value/TraceSet/Events/Properties/Property[(@Descriptor='100')]

  9. Add the condition expression to check if the Violation time result exists.

    Not(Boolean(Results/Result[Label='Message'and(Value='OK')]))

    and click OK.

  10. Refresh the report.

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