PXML variables

The PXML expression language provides variables to define the layout dynamically.

These variables can be used in any PXML expression:

  • max - the maximum extent of the current parent box
  • min - the minimum extent of the current parent box
  • rest - the remainder of the current parent box
    Note:

    If the parent object is a propagating container and the child object does not fit in the remaining space for the parent object, the rest variable for the Y-Size property yields the same value as max (the child expands to the maximum extent of the parent). This forces the parent object to propagate and avoids overfullness.

    To state another way, if the child has a size of x (in the layout direction of the parent) and the amount of space left in the parent is y, then rest yields y if x <= y; otherwise rest yields max.

Tip:

In previous versions of Genero Studio, to force a page break after the object, you would use the rest variable in the Y-Size or X-Size properties. This is no longer required; you can now force a page break using the Break element.

Centering an element

To center an element in its parent container, use the max variable for these properties:

Table 1. Centering an element
Property Value
x max/2
y max/2
anchorX 0.5
anchorY 0.5

Using min, max, or rest for sibling boxes of a Mini Page

If you have sibling boxes of a Mini Page in the Report Structure – where the sibling boxes are Mini Pages and/or Layout Nodes that do not have the Section property set – then follow these guidelines when setting the values for Y-Size and Y-Size Adjustment or X-Size and X-Size Adjustment. Whether you set for the Y axis or the X axis will depend on the Layout Direction of the parent box.

Consider a parent box that has its Layout Direction set to "topToBottom", which means the box grows vertically along the Y axis. If you add two or more child boxes that do not have the Section property set, you want to:
  • Set the Y-Size to "min" for the first sibling. You can leave the Y-Size Adjustment property empty.

    The assumption here is that the first sibling will take up some space; to summarize: it does not have the Section property set, its size isn't zero, and and who doesn't have Y set because otherwise it would float and take up no space.

  • Set the Y-Size to "rest" and the Y-Size Adjustment to "shrinkToChildren" for any sibling that has a previous sibling.
Alternatively, consider a parent box that has its Layout Direction set to "leftToRight", which means the box grows vertically along the X axis. If you add two or more child boxes that do not have the Section property set, you want to:
  • Set the X-Size to "min" for the first sibling. You can leave the X-Size Adjustment property empty.

    The assumption here is that the first sibling will take up some space; to summarize: it does not have the Section property set, its size isn't zero, and and who doesn't have X set because otherwise it would float and take up no space.

  • Set the X-Size to "rest" and the X-Size Adjustment to "shrinkToChildren" for any sibling that has a previous sibling.
Understanding these facts can help to explain these settings:
  • If you set a size of a box to "min", that is the same as setting the size to "max" and the adjustment to "shrinkToChildren".
  • For each of the siblings, the value "max" is the same. Unlike "rest", "max" does not take siblings into account. If the second child has the "max" size (after applying the "shrinkToChildren") and the first child takes up any space, they both cannot fit in the parent and the second child is moved to the next clone of the parent Mini Page.