3.11 Constant
CRS can handle numbers and character strings as constants, and there are the following types.
| Types | CRS Types | Notation example | |
|---|---|---|---|
| Numerical value | Decimal integer | Number | 100, -100 |
| Hexadecimal integer | 0xFF, -0xFF | ||
| Real number | 3.14, -3.14 | ||
| Logical type | true, false | ||
| Fixed point number Not supported by AI | Fixed | 10.19F, -10.19F | |
| Character | String | String | “sky \ n” |
| Time | date | Date | “2003/09/01” |
| Times of Day | “2003/09/01 12:10:11” |
You can also use the special character “" to include control codes, string delimiters, etc. in the string. The control code and its notation are shown below.
| Control code, character | Notation | Example of use |
|---|---|---|
| new line | ¥n | “1st line ¥ n 2nd line “ |
| return | ¥ r | “1st line ¥ r ¥ n 2nd line “ |
| tab | ¥ t | ” Item 1 ¥ t Item 2 “ |
| ¥ | ¥¥ | “¥¥100” |
In addition to the above, you can use package-specific constants defined in the package, such as CSV constants. Package-specific constants are typically used to initialize an object with the « operator.
CSV constant example
CsvDocument csvdoc << csv {
1,2,3
4,5,6
};
Package-specific constants are defined in the following format:
Prefix [ ' ( ' argument list' ) ' ] Start CODE Data body End CODE
For the previous CSV constant, the prefix is “CSV”, the argument list is omitted, the start CODE is “{“, the end CODE is “}”, and the data bodies are 1,2,3 and 4,5,6. The prefix, start CODE, and end CODE are defined by the package. For example, in the case of an xml constant, the prefix is “XML”, the start CODE is “«-“, and the end CODE is “-»”.
XML constant example
XmlDocument xmldoc << xml <<-
<?xml version="1.0"?>
<sample>
<node/>
</sample>
->>;
Inside the package-specific constant description, the CRS specification has no effect. CRS-specific constants and expressions cannot be described.
$ DESIGNTIME constant
The $ DESIGNTIME constant is used during CRS script development by Biz / Designer.
In Biz / Desiger, changes to the CRS script are immediately reflected in the design pane. This behavior is useful for checking the creation screen, but you may find it unnecessary for processes that do not need to be checked immediately.
By using the $ DESIGNTIME constant, it is possible to write it so that it does not work during design.
$ DESIGNTIME constant
| true | Writing CRS script by Biz / Designer |
| false | Debugging with Biz / Desinger Or running with Biz /Browser |
Example
if (! $ DESIGNTIME) {
/ * Processing not executed during design * /
}
Some methods and properties may result in an error when executed during design. You can avoid the error by describing those processes in the if statement with the condition set to ! $ DESIGNTIME (other than at design time) as in the above usage example.