You may come across a situation where you would like to restrict the user to enter limited characters in a field. Sage X3 has a special feature in which you can validate the fields with the help of “Chgfmt” keyword.
Chgfmt: It is used to change the format of the mask field. It is also used to display or hide any fields.
Syntax:
Chgfmt [class] field with expr_c
Parameter details:
class : name of the mask
field : name of the field
expr_c : expression to hide a field.
Kindly refer to the below snippet of code for better understanding
In the below screen, the user cannot move to next step until he enters proper value.
Here’s some sample code for chgfmt.
Chgfmt [M:XMT0]SCEAXX With “K:8A”—To allow only 8 Upper case characters
Chgfmt [M:XMT0]SCEAXX With “K:3A” — To allow only 3 Upper case characters
Chgfmt [M:XMT0]SCEAXX With “-K:3A” — To hide the field
Chgfmt [M:XMT0]SCEAXX With “K:2X5a”—To allow only 2 numbers and 5 lower case charactors
Chgfmt [M:XMT0]SCEAXX With “K:250a”– To allow only 250 Lower case characters
Chgfmt [M:XMT0]SCEAXX With “K:250A”– To allow only 250 Upper case characters
Chgfmt [M:XMT0]SCEAXX With “3A2X#”—To Allow 3 uppercase letters, 2 any characters, followed by a figure.
Also Read:
1. Adding Styles to Screen Fields in X3
2. Getting number of fields in table
3. Auditing Fields in Sage ERP X3
4. How to access screen using Code
5. Closing of Screen via Code