Parameter Formats
Process definition parameter values can have a specific format for use with specific definition types. For example, you want 1000
to be displayed as 1,000
. The Format property on the process definition or chain parameter allows you to specify a formatting mask. Platform processes operate on string values, instead of the type-safe object values (like RedwoodScript).
A date value can be represented as a string in numerous ways, to limit this to a specific format, a Format can be defined.
Each parameter data-type (string, number, date) has its own format mask definition.
Once defined, whenever the process runs the parameter value will be formatted using the Format. Out parameter return values are also parsed back from a string to a number or date object.
note
You must pay special attention when you use parameters with both Constraints and Parameter Formats, as the resulting format must match with the format of the constraint.
note
The Format of RedwoodScript process definition is ignored, since the value is passed as an object value directly (and not as a string value).
note
On the process's show page, the parameter values are always rendered using the Process Format (for dates their is a default format) so the values are always displayed in a static format.
Date
Dates use an extended implementation of the DateTimeFormatter. You specify the locale by specifying the {<locale>}
, for example "{de} dd. mmm, yyyy"
, which would print the date in the German (Germany) locale. You specify the Olson timezone using i
.
See Simple Date Format for syntax and examples.
note
The date-formatting can also be used with RedwoodScript as long as the type is DateTimeZone
.
Example
Print the date in the Spanish (Spain) and German (German) locale.
"{es}dd MM yyyy" // 06 04 2013
"{de}dd MM yyyy HH:mm:ss:SSS i" // 06 05 2013 16:53:38:200 Europe/London
Number
#
- Digit, when the value does not contain this position it will be omitted.0
- Digit, when the value does not contain this position it will be occupied with a zero.d
- Digit, when the value does not contain the decimal position it will be omitted.D
- Digit, when the value does not contain the decimal position it will be occupied with a zero.,
- Decimal or Group separator.
- Decimal or Group separator- `` - Group separator
*
- Preserve the value range, and do not limit to the amount of specified digits.
Example
[[formatmask, value, output]
"#", null, null
"#", "1234", "4"
"*#", "1234", "1234"
"#*", "1234", "1234"
"####", "1234", "1234"
"#,###", "1234", "1,234"
"#,###.DD", "1234", "1,234.00"
"#,###.DD", "1234.56", "1,234.56"
"#,###.DD", "1234.56", "1,234.56"
"*#,###.DD", "123456.78", "123,456.78"
"###.###,DD", "123456.78", "123.456,78"
"0000", "1", "0001"
"000#", "1", "001"
"0,000.DDD", "1", "0,001.000" // No optional position
"#.##.##.##,dd", "1234", "12.34" // No default group size
"#,##.dd", "1234.56", "234.56"
"####", "1", "1"
"##.dd", "12", "12"
"##.dd", "12.34", "12.34"
"# ###", "1234", "1 234"
"#", "-1", "-1"
"#.Dd", "1", "1.0"
"*000", "1", "001"
"#.D*", "123.456", "3.456"
"*#.D", "123.456", "123.4"
"*#.D*", "123.456", "123.456"
Invalid Examples
null
"any invalid string"
"1234"
"#,D###.DD" // decimal position
"###,## ###" // distinct group separator
"#,##,###.DD" // distinct group size
"#*#" // preserve range must be first and/or last
"#0" // leading zero must be first
"#.dD" // optional decimal must be last
"#D" // no decimal separator
String
U
- Single chararacter, make upperL
- Single chararacter, make lower*
- Repeat last mask character until value ends
Example
[[formatmask, value, output]
"U*", null, null
"UU", "Aap", "AA");
"U*", "Aap", "AAP");
"L", "Aap", "a");
"UL*", "aap", "Aap");
"L*", "AAP", "aap");
"U*", "aap", "AAP");
Invalid Examples
"U*L" // repeat must be last
File
FileParameter
- changes the File parameter value to hold a FileParameter object.
See Also
Process Format