ObjectScript supports the embedding within it of the following types of code:
Embedded HTML statements are set off from the rest of the code by the &html< code >
directive, as shown in the following example:
The &html directive must be indented; it cannot appear in column 1.
The &html directive is not case-sensitive; you can specify &HTML, &Html, or &html.
The &html directive can appear on the same line as a label, a command, or a /* ... */ comment. Like all ObjectScript code, it must be separated from an argumentless command that precedes it by at least two spaces.
The &html directive is followed by an open angle bracket, with no intervening spaces, line breaks, or comments. The embedded HTML code is terminated by a close angle bracket.
HTML code within Embedded HTML and the close angle bracket do not have to be indented. They can appear in column 1, though for clarity of code the use of indents is recommended.
HTML code does not have to include the <html> structural tag (or any other structural tag); however, structural tags are fully supported.
The body of an &html directive should contain valid HTML tags. You can format your HTML in any way you like with indents and white space. Blank lines within HTML code are retained. Studio recognizes the &html directive and uses the colorizer to syntax color the HTML tags.
The Macro Preprocessor expands macros before the ObjectScript parser handles any Embedded HTML code. There is no support for macro processing within embedded HTML. For example, you cannot use ##;
single-line comments within Embedded HTML. You can, however, use the results of the macro preprocessor in Embedded HTML code, as shown in the following example:
#Define NumFunc ##Expression(17+4)
<i>I'm italic $$$NumFunc</i>
You can identify a specific &html directive using user-defined marker syntax. This syntax consists of a character or string specified between &html and the open angle bracket character. The reverse of this marker must appear immediately after the closing angle bracket at the end of the Embedded HTML. The following example uses 7 as a marker character:
Note that no white space (space, tab, or line return) is permitted between &html, the marker
, and the open angle bracket, and no white space is permitted between the closing angle bracket and reverse-marker
can be a single character or a series of characters. A marker
cannot contain the following punctuation characters:
cannot contain a whitespace character (space, tab, or line return). It may contain all other printable characters and combinations of characters, including Unicode characters. The marker
are case sensitive.
&html@@< <b>Be bold!</b> >@@
&html[< <b>Be bold!</b> >]
&htmlMyTest< <b>Be bold!</b> >tseTyM
&htmlA16[a< <b>Be bold!</b> >a]61A
Embedded SQL allows you to include SQL code within an ObjectScript program. The syntax is &sql( )
. For example:
&sql( SELECT Name INTO :n FROM Sample.Person )
WRITE "name is: ",n