Size a column based on data

Base the size of a column on the size of the translated text displayed in it.

For this example, you want the Price column to be wide enough to fit the column heading and the displayed data. You also want to translate the column heading into the system language.

To translate the heading, include the translate() function in the Text property, as in the following expression:
"Price".translate()

To make the column wide enough to contain the translated text and data, set the X-Size property to the following expression:

max(width("{"Price".translate()}"),width("-0,000,000.00"))
Code elements:
  • max() determines that X-Size is the larger of the two comma-separated numbers.
  • width("{"Price".translate()}") is the width of the translated label. The string "Price".translate() is an RTL expression within a PXML expression, and therefore must be within curly braces.
  • width("-0,000,000.00") is the maximum width of the data within the column.

The column width will be the maximum width of the data displayed in it or the localized column title, whichever is wider.