Symptom
A formula using SYS_PageInDocument or a similar page or document system variable produces the wrong value or no value at all.
Related shapes of the same defect:
- A section-driven subdocument reports a page number from the wrong scope.
- A rule looks correct when inspected but evaluates before the variable holds the value the object needs.
- The same formula works in one placement and fails when moved to another text box.
Cause
The engine evaluates a rule or formula at the timing point attached to the object being composed. If that point comes before the page, section, or document state has been established, the variable is read too early and the expression sees an empty or stale value.
Formula reset time and compute time are separate controls. A value can also be reset at a customer or section boundary before a later object gets to use it. The defect is execution order. The identical formula produces different results on a page object, a section object, or a late-composed object.
Fix
Identify which state transition creates the value you need, then set the formula's compute time after that transition.
For page-driven values in the classic engine, a known technique is to place a harmless reference to a later system value such as SYS_PagePrintedValue in the same text box, forcing the object to be composed after the value exists, and exclude that reference from output with a text rule.
For rules, decide deliberately whether the rule should run at normal composition time or at end-of-document processing.
Verify with a test application that has at least two customers and multiple sections, so reset timing and compute timing are exercised separately. One customer with one section hides exactly the boundary behavior you are trying to fix.
Do not mask timing defects with reset settings
Changing the formula cannot fix a timing mismatch. Setting a variable to never reset can hide the timing problem while leaking the previous customer's state into the next document, turning a visible error into a data-integrity defect.
The timing model is corroborated in classic documentation, but variable names and supported timing options are release-specific, and none of this maps directly onto current cloud-native expression behavior.