Advanced XFA Picture Clauses
Enable TXFAWidgetRuntimeOptions.ScriptOptions.EnableJavaScript to use these pictures in FormCalc events, calculate and validate scripts through the shipped QuickJS engine
Format(picture, value) produces display text and Parse(picture, text) produces canonical values; locale selection, quoted literals and alternatives follow FormCalc Locale and Picture Functions
Numeric precision and scientific notation
| Symbol | Behaviour |
|---|---|
E | Formats a signed base-10 exponent after the mantissa; the leading and fractional digit positions determine mantissa precision, with rounding carry applied before the exponent is emitted |
8 | Retains the expressed fractional precision of supplied decimal text, including trailing zeros; absent fractional digits omit the decimal radix, and a run of 8 symbols can preserve more supplied fractional digits than its length |
Scientific mantissas use at most 15 digit positions; exponent magnitudes and decimal expansion are bounded to 10000, and nonfinite values produce empty text
Precision pictures preserve quoted literals before and after fractional positions; percent scaling shifts the original decimal text without losing trailing zeros through binary floating point conversion
Pass decimal strings when their expressed precision matters; JavaScript numeric values have already undergone binary floating point conversion before formatting
Format("num{99.999E}", 12345) // 12.345E+3
Parse("num{99.999E}", "12.345E-2") // 0.12345
Format("num{zzz,zz9.8}", "12345.0000") // 12,345.0000
Parse("num{zz9.8}", "12.3400") // 12.3400
Format("num{zz9.8%}", "0.1250") // 12.50%
Ordinal and week dates
| Symbol | Behaviour |
|---|---|
J, JJJ | Day of year, from 1 to 366; JJJ pads to three digits and parsing validates leap years |
E | Numeric weekday from 1 for Sunday to 7 for Saturday; EEE and EEEE continue to use abbreviated and full locale weekday names |
e | ISO weekday from 1 for Monday to 7 for Sunday |
WW | ISO week from 01 to 53; week 01 contains 4 January, and a year in this picture is the ISO week year |
w | Month week from 0 to 5, beginning on Sunday; the first week must contain at least four days from the month |
Parsing ordinal or week dates returns the corresponding ISO calendar date; contradictory day, month, weekday or week values return empty text
Four-digit early years are constructed without the JavaScript century adjustment, including years 0000 to 0099; historical alternate eras remain outside these pictures
Format("date{YYYY-JJJ}", "2024-02-29") // 2024-060
Parse("date{YYYY-WW-e}", "2020-53-5") // 2021-01-01
Format("date{w}", "2004-07-03") // 0
Additional clock variants
k and kk express a 0–11 hour within the meridiem; K and KK express a 1–24 hour within the day, with 24 representing midnight
Use A with k clocks to distinguish AM and PM; lowercase z formats an ISO offset without a colon, zz uses a colon, and uppercase Z emits GMT or GMT with an explicit offset
Global picture symbols
| Symbol | Input parsing | Output formatting |
|---|---|---|
? | Consumes one Unicode code point | Produces one space |
* | Consumes zero or more breakable whitespace characters | Produces one space |
+ | Consumes one or more breakable whitespace characters | Produces one space |
These symbols work within date, time, datetime, number and text pictures; quoted symbols remain literal characters, supplementary Unicode characters count as one character, and nonbreaking spaces are excluded from whitespace matching
Compound input parsing
Compound date and time clauses combine into canonical ISO date-time text; repeated representations of the same value must agree, and literal delimiters are checked before accepting the input
Repeated scalar clauses must produce the same canonical number or text; incompatible category combinations, contradictory values, incomplete consumption or multiple distinct canonical results produce empty text
Compound parsing permits 64 parts, 8192 UTF-16 input units and 8192 parse attempts, whilst sharing the runtime operation and elapsed-time budgets; exceeding these limits fails the event transaction
Parse("date{YYYY-MM-DD} time{HH:MM:SS}", "2024-02-29 12:34:56")
// 2024-02-29T12:34:56
Parse("date{YYYYMMDD}time{HHMMSS}", "20240229123456")
// 2024-02-29T12:34:56
Runtime behaviour and current boundaries
Calculated fields and events use the same implementation and locale metadata; failed scripts restore document values and committed JavaScript state, and saved XDP data retains successful results
Alternate-era calendars, ideographic and full-width representations, localised display-only symbols and complete grouping policies remain separate targets
See Interactive XFA Widget Runtime for transaction, replay and operation budget behaviour