Skip to content
Software AthleteSoftware Athlete
Create Dynamic On-Demand Calculations in PI Vision

PI Vision how-to

Create Dynamic On-Demand Calculations in PI Vision

Build a PI Vision display that lets users choose a time range, trigger an AF Analysis, and inspect the calculated result without creating a separate analysis for every range.

Updated August 27, 2026Originally published February 15, 2025Reviewed by Software Athlete PI Vision engineering

Before you start

This workflow uses an AF Element as the contract between the display and the calculation. Prepare the element, its attributes, and the analysis before you build the PI Vision display.

  • Decide which attributes hold StartTime, EndTime, the trigger, the input values, and the output.
  • Confirm that the display user has permission to write the input and trigger attributes.
  • Choose the interval boundaries, time zone, units, and no-data behavior before testing.
  • For the display controls, Quick Input+ is the matching Vision Library+ control. The Vision Library+ documentation covers the wider symbol collection and setup information.

Design the handoff first: the operator should be able to see the selected interval, the trigger state, the output value, and when the result was last calculated.

Step 1

Create the AF Element and its attributes

Create an AF Element that gives the calculation a stable home. Use clear names so the AF Analysis and the PI Vision display refer to the same contract.

1

Define the selected interval

Create attributes for StartTime and EndTime. Decide whether the end boundary is inclusive and how the display time zone maps to the AF timestamps.

2

Add a deliberate trigger

Create a trigger attribute or event path. The trigger should change when the user is ready to run the calculation, not on every keystroke while the interval is being edited.

3

Map inputs and output

Reference the PI Points or AF Attributes used by the expression, then expose the calculated result through an output attribute with a documented unit and meaning.

AF element attributes for start time, end time, trigger, inputs, and output in an on-demand PI Vision calculation
Use one named AF Element contract for the interval, trigger, input values, and calculated output.

Step 2

Build the AF Analysis

Create the AF Analysis that evaluates the selected interval. The analysis should read the time attributes instead of using a fixed time range in the expression.

  1. Reference StartTime and EndTime as the calculation boundaries.
  2. Use the input attributes in the expression and define how missing data is handled.
  3. Set the execution mode so the analysis runs when the selected inputs or trigger change.
  4. Write the result to the output attribute and make the unit and result type clear.
AF Analysis configuration for evaluating a PI Vision calculation over a selected time range
The analysis uses the selected timestamps as inputs, so one configuration can evaluate different ranges.

Step 3

Configure when the calculation runs

A trigger separates editing the inputs from executing the calculation. Use the option that fits the workflow:

  • Trigger from a StartTime or EndTime change when the result should update immediately.
  • Use a dedicated trigger attribute when the user should review the full interval before execution.
  • Make pending, completed, and failed states visible to the user.
  • Avoid triggering on every display refresh unless that behavior is intentional and tested.
Event-triggered AF Analysis configuration for a PI Vision on-demand calculation
The trigger provides a clear execution point after the interval and inputs are ready.

Step 4

Build the PI Vision display

Expose the inputs and output on one display. Quick Input+ can provide controls for StartTime, EndTime, and the trigger. Add a native Value Symbol or another suitable PI Vision element for the output.

  • Label the start and end values and show the expected time format.
  • Keep the trigger near the inputs it acts on.
  • Show the output unit and, where useful, the selected interval.
  • Show a last-calculated timestamp or status so users can identify a stale result.
PI Vision display with Quick Input+ controls for time range and trigger plus a calculated output value
Keep the controls, trigger, and calculated output together so the handoff is visible on the display.

Step 5

Test the complete path

Test from the display input to the AF output. A successful run means the selected timestamps reach the analysis, the analysis executes, and the expected value is written and displayed.

1

Use a known interval

Choose a range with an expected result and record the time zone and boundary behavior used by the test.

2

Run the trigger

Change the configured trigger and confirm that the analysis receives the new timestamps and inputs.

3

Check the result

Compare the output value, timestamp, unit, and quality with a known-good calculation or direct data query.

4

Repeat with edge cases

Test a reversed interval, no-data range, short range, repeated trigger, and a user without the required write permissions.

PI Vision on-demand calculation output updating after a selected time range is triggered
Confirm that the output changes after the intended calculation completes and that its status is understandable.
Symptom Check first Useful test
Output does not change Trigger path, analysis execution, or stale display value Change the trigger directly and compare the output timestamp.
Wrong interval is used Time zone, attribute mapping, or boundary logic Test one known start and end timestamp at each handoff.
Analysis fails for some ranges Missing data, invalid input, permissions, or expression assumptions Run a short known-good range, then expand it.
Display shows a stale result Refresh behavior or output configuration Show the last-calculated timestamp and reload after a trigger.

Common questions

On-demand calculation FAQ

Why use a trigger instead of continuous recalculation?

A deliberate trigger lets the user finish selecting the interval before the analysis runs. It also makes the execution point easier to test.

Can users change the time range from PI Vision?

Yes, when the controls are connected to writable AF attributes or another approved input path. Make the time format and permissions clear.

What should the display show besides the result?

Show the unit and, where useful, the selected interval and last-calculated timestamp so users can distinguish a fresh value from an earlier result.

Leave a comment

Your email address will not be published..

Cart 0

Your cart is currently empty.

Start Shopping