X3 script keywords glossary
The Sage X3 scripting language includes a list of keywords. Not all these keywords are used, but they remain reserved words in the language.
Keyword use
When a keyword exists, it is recognized as an element of the language regardless of its letter case. Otherwise, a symbol is automatically created in upper case.
For example, For
is a keyword in the Sage X3 scripting language; therefore, you cannot use for
, fOr
, foR
, FOr
, FoR
, fOR
or FOR
to define a symbol (variable, instance, class name, and so forth) in any scripting program.
Likewise, a variable called FOO
can be spelled foo
, Foo
, fOo
, foO
, FOo
, FoO
, fOO
, which represents the same variable. The script editor will automatically rewrite it FOO
.
This will change in the future when a new policy is defined, but for now it is important to have a list of all the keywords to avoid using them inadvertently.
Keyword status
Though deprecated, some of these keywords still exist for compatibility reasons with earlier versions.
The following tables provide lists of keywords with their status and a link to the corresponding documentation if available. for readability reasons, the deprecated and internal keywords have been put on separated tables.
The different statuses for these keywords are:
- Deprecated Classic: The keyword must not be used in version 7 style programming, and also in version 6 style programming for Classic mode. It must therefore be replaced in V6 code to use it in Classic mode.
- Deprecated: The keyword must not be used in version 7 style programming, although it can still be used in version 6. Its availability in future versions is not guaranteed.
- Internal: This keyword can only be used by the supervisor layers. Its use is strongly discouraged since its behavior is subject to change without notice.
- Public: This keyword already exists in version 6 and can be used without restrictions.
- New: This keyword has been introduced in version 7 and can be used without restrictions.
Keyword lists tables description
The following tables list all keywords of the Sage X3 scripting language in version 6 with the following columns:
- The keyword name.
- The status of the keyword.
- The syntax for the keyword only described for functions that are public or new. The following letters are used in the syntax:
n
represents a numeric value.d
represents a date value.i
represents an integer value.b
represents a bit value (0/1)c
represents an instance (class or representation).s
represents a character string.u
represents a logical value (0 or not 0).p
represents a parameter with an undefined or particular type....
means that a variable number of parameters can be used.
- A short description of the purpose of the keyword if it is not internal or deprecated.
Links are available from the keyword to the detailed documentation when applicable.
List of keywords
System variables or methods | Instructions of the language | Functions of the language |
---|
1. System variables or methods
Public and new keywords
keyword | Category | Definition or comments |
adxdcs | Public | Pivot date |
adxdir | Public | Directory where the runtime is installed |
adxdlrec | Public | Number of lines deleted by a "Delete Where" syntax |
adxfname | Public | Name of the columns in an [F] record associated with a database table |
adxftl | Public | Defines the cache size for database "Read" operations |
adxifs | Public | Field separator for sequential file operations |
adxirs | Public | Record separator for sequential file operations |
adxium | Public | Character encoding option for sequential file operations |
adxlog | Public | Returns 1 if application is in transaction state, 0 if not. |
adxmda | Public | Defines the angular mode |
adxmother | Public | Reference folder name |
adxsqlrec | Public | Number of lines updated by a direct SQL syntax |
adxtct | Public | Defines the table for counters (APLCOM) |
adxtlk | Public | Defines the symbol locks table (APLLCK) |
adxtms | Public | Defines the messages table (APLSTD) |
adxuprec | Public | Number of lines updated by an "Update" instruction in the database |
adxwrb | Public | Defines the cache size for database "Writeb" operations |
currind | Public | Current index used by default on a database table |
currlen | Public | Defines the size of the current key (see currkey) |
dbgmode | Public | variable that enables or disable the ability to run the debugger. |
fstat | Public | Returns a status (return code) of last database or sequential file operation |
getaccessorenabled | New | Defines if the "Get" accessor is enabled on an instance |
indcum | Public | Current index used by default in sigma syntax |
isreadonly | New | Defines if an object is "Readonly" (1) or not (0) |
lockwait | Public | Defines the "Wait" time in seconds for readlock |
nbind | Public | Number of indexes defined in [G] record for a table |
nbzon | Public | Number of columns defined in [G] record for a table |
nomap | Public | Current folder name |
reckey | Public | Used to avoid an "Order by" clause in "For" instruction |
setaccessorenabled | New | Defines if the "Set" accessor is enabled on an instance |
snapshot | New | Instance storing the initial value of an instance |
snapshotenabled | New | Property of a class defining if the snapshot is activated |
stat1 | Public | Error status or number of lines returned by System |
tairec | Public | Record size defined in [G] record for a table |
this | New | Access to the current instance in a method |
updtick | New | Column storing the "revision number" for a database table line |
Deprecated and internal keywords
|
|
2. Language instructions
Public and new keywords
keyword | Category | Definition |
Anasql | Public | Parses an SQL instruction |
Append | New | Appends a string or CLOB to a string or CLOB |
As | Public | Used in several syntaxes |
Asc | Public | Ascending mode in some syntaxes |
Assign | Public | Assigns a variable given by a string value with a computed value |
Blbfile | Public | BLOB declaration |
Break | Public | Break in "For...Next", "Repeat...Until", "While...Wend" loops |
By | Public | Used in several syntaxes. See [Order By](../4gl/order-by.md) |
Call | Public | Calls a subroutine |
Case | Public | Defines a branch sequence based on list of values |
Char | Public | String character variable declaration |
Clbfile | Public | CLOB variable declaration |
Close | Public | Closes a database table (See [Local](../4gl/local.md) [File](../4gl/file.md)) |
Columns | Public | Defines a list of columns that will be read on a database table on "For" loops |
Commit | Public | Triggers a "Commit" of modifications done in the database |
Const | Public | Declares parameters of a "Call" as a constant value |
Contains$ | Public | Checks if a parsed JSON file contains a given property. |
Curr | Public | Used in different database access syntaxes (current line) |
Date | Public | Date variable declaration |
Datetime | Public | Datetime variable declaration |
Dbgaff | Public | Open debugger |
Decimal | Public | Decimal number declaration |
Default | Public | Used in different syntaxes |
Dela | Public | Deletes lines in a set of variable arrays |
Delete | Public | Deletes lines in the database |
Deletebykey | New | Deletes lines in the database with a control on "Updtick" |
Desc | Public | Descending mode in some syntaxes |
Double | Public | Double precision floating variable declaration |
Else | Public | Alternative choice in an "If" sequence |
Elsif | Public | Alternative condition in an "If" sequence |
End | Public | Ends a subprogram or a function |
Endcase | Public | Ends a "Case" sequence |
Endif | Public | Ends an "If.. Elsif.. Else.." sequence |
Execsql | Public | Executes an SQL order |
Extended | Public | Option Key word of [Columns](../4gl/columns.md) instruction |
File | Public | Database table or view declaration |
Filter | Public | Adds a filter ("Where" clause) on a database table |
First | Public | Reads the first line in different database access syntax |
Float | Public | Floating point variable declaration |
Flush | Public | Flushes the "Write" buffer when using buffered database Writen b instruction |
Fmethod | New | Calls a method on an instance |
For | Public | Loop on a set of values for a variable or on a database cursor |
FreeInstance | New | Releases the memory used by an instance |
FreeGroup | New | Releases the memory used by a group of instances |
From | Public | Used in different syntaxes |
Funprog | Public | Function declaration |
Getseq | Public | Reads data in a file in binary mode |
Global | Public | Prefix of a declaration if the variable is in the [V] class |
Gosub | Public | Calls a subroutine (ends with return) |
Goto | Public | Branches on a label |
Hint | Public | Used to specify hints to a database on SQL request execution |
If | Public | Test sequence |
Insa | Public | Insertion of values in a list of variable arrays |
Instance | New | Declares an instance pointer |
Integer | Public | Integer variable declaration |
Iomode | Public | Sets "Read / Write" options on sequential files |
Key | Public | Used in different syntaxes |
Kill | Public | Frees a variable |
Last | Public | Reads the last line in different database access syntaxes |
Link | Public | Performs a "Join" between tables in a SQL cursor declaration |
Local | Public | Prefix of a declaration if the variable is in the local [L] class |
Lock | Public | Locks a symbol or used as modifier in SQL syntaxes |
LogicClose | Public | Closes a Table declared by File in an optimized way |
Look | Public | Performs a select on a database without filling the [F] buffer |
Method | New | Method declaration |
Next | Public | Ends a "For" loop; also used as Read mode |
NewInstance | New | Creation of a new instance for a given class |
Nohint | Public | Disables default hints sent to the database in SQL queries |
Onerrgo | Public | Declares a label in which a branch will be done if an error occurs |
Openi | Public | Opens a file for reading data #@ file path (to be opened on the SAFE X3 client) are no more supported |
Openio | Public | Opens a file for reading and writing data #@ file path (to be opened on the SAFE X3 client) are no more supported |
Openo | Public | Opens a file for writing data #@ file path (to be opened on the SAFE X3 client) are no more supported |
Order By | Public | Used in different database access and sorting syntax ("Order by" option) |
ParseInstance | Public | Parses a JSON string. |
Prev | Public | Reads the previous line in different database access syntaxes |
Putseq | Public | Writes data in binary mode in a file |
Raz | Public | Fills variable with a null value |
Rdseq | Public | Reads data as characters string in a file |
Read | Public | Reads a line from a cursor in a database |
Readlock | Public | Sets a lock on a line on a database cursor and returns its content |
RenameFile | New | Renames a file |
Repeat | Public | Starts a "Repeat..Until" loop |
Resume | Public | Ends the exception handling after an "Onerrgo" branch |
Return | Public | Ends a subroutine called by "Gosub" |
Rewrite | Public | Updates the current line in the database |
Rewritebykey | New | Updates the current line in the database (with a condition on "Updtick") |
Rollback | Public | Performs a rollback on the current database transaction |
Schar | Public | Declares a single char (1 byte) variable |
Seek | Public | Moves the "Read / Write" pointer in a sequential file |
Select$ | Public | Selects properties from a parsed JSON file. |
Setlob | Public | Assignment of "CLOB" values |
SetInstance | New | Global assignment of properties of a class |
Shortint | Public | Declares a short integer variable |
Sleep | Public | Suspends for a given number of seconds the execution of the current program |
Sorta | Public | Sorts lines in a set of variable arrays |
Sql | Public | Used in several syntaxes to access database through a direct SQL statement |
Stability | Public | Option key word on "For" clause |
Step | Public | Used in "For" syntaxes to define the step to increment the variable loop |
Subprog | Public | Declares a subprogram called by "Call" |
System | Public | Used by different syntaxes to execute operating system commands #@ orders (to be executed on the client) are no more supported |
Then | Public | Used optionally in the "If" syntax |
Tinyint | New | Declaration of a small integer (0-255 range, used for bytes values). Replaces Libelle |
To | Public | Used in the "For" syntax to define the end value for a variable loop |
Trbegin | Public | Starts a database transaction |
Unlock | Public | Releases a logical lock |
Until | Public | Ends a "Repeat... Until" sequence |
Update | Public | Updates lines in a database cursor defined by a condition |
Using | Public | Used in different syntaxes |
Uuident | New | Declares a unique "ID" variable |
Value | Public | Declares a parameter sent as a value in a subprogram |
Variable | Public | Declares a parameter sent as a reference in a subprogram |
Wend | Public | Ends a "While...Wend" sequence |
When | Public | Used in "Case...Endcase" sequences to define a list of choices |
Where | Public | Used in different database syntaxes |
While | Public | Starts a "While...Wend" sequence |
With | Public | Used in different syntaxes |
Write | Public | Inserts a line in the database |
Writeb | New | Buffered "Write" to database |
Wrseq | Public | Writes data in string mode in a file |
Deprecated and internal keywords
The keyword present here are deprected at least for V7+ code, but some of the keyword are still usable in classic pages and are therefore documented (a link is present on these functions
|
|
3. Functions of the language
Public and new keywords
keyword | Category | Syntax | Definition |
abs | Public | n=abs(n) | Absolute value function |
ach | Public | n=ach(n) | Inverse hyperbolic cosine |
acos | Public | n=acos(n) | Inverse cosine |
addmonth | Public | d=addmonth(d,n) | Adds months to a date |
adxmac | Public | s=adxmac(i) | Returns name of the servers |
adxpno | Public | s=adxpno(i) | Returns the stack of the calling scripts |
adxseek | Public | i=adxseek(p) | "Read / Write" pointer on a file |
adxtcp | Public | i=adxtcp() | Returns the connection port |
adxuid | Public | i=adxiud(i) | Unique session identifier |
allocgrp | New | s=c.allocgrp | Allocation group for an instance |
and | Public | l=n and n | Logical "And" |
anp | Public | i=anp(i,i) | Ordered arrangements (statistical function) |
ar2 | Public | n=ar2(n) | Rounding to two digits |
arr | Public | n=arr(n,n) | Rounding |
ascii | Public | i=ascii(s) | ASCII code of first char in a string |
ash | Public | n=ash(n) | Inverse hyperbolic sine |
asin | Public | n=asin(n) | Inverse sine |
atan | Public | n=atan(n) | Inverse tangent |
atan2 | Public | n=atan2(n,n) | Inverse tangent of a slope |
ath | Public | n=ath(n) | Inverse hyperbolic tangent |
avg | Public | n=avg(p) | Average value of a list of numeric values |
aweek | Public | d=aweek(i,i) | First day of a week in a year |
b64encode | New | i=b64encode(s,s) | Base 64 encoding of a string |
b64decode | New | i=b64decode(s,s) | Base 64 decoding of a string |
cast | New | c=cast(c,s) | Forces a class pointer type |
ch | Public | n=ch(n) | Hyperbolic cosine |
checkpath | New | i=checkpath(s,i) | checks the path validity against engine sandbox rules |
chr$ | Public | s=chr$(i) | Character from ASCII code |
clalev | Public | i=clalev(p) | Level value for a variable class |
clanam | Public | s=clanam(p) | Variable class name |
clanbs | Public | i=clanbs(p) | Variable class number of variables |
clasiz | Public | i=clasiz(p) | Size of a variable class |
clavar | Public | s=clavar(p,i) | Name of a variable in a variable class |
clacmp | Public | i=clacmp(p,p) | Compares two variable classes |
closelog | Public | i=closelog() | Closes the log file |
cnp | Public | i=cnp(i,i) | Combinations (statistical function) |
copfile | Public | i=copFile(s,d) | Copies a file. |
cos | Public | n=cos(n) | Cosine |
ctrans | Public | s=ctrans(s...) | String character substitutions |
date$ | Public | d=date$ | Current date |
datetime$ | New | dt=datetime$ | Current date/time |
day | Public | i=day(d) | Current day |
day$ | Public | day$(p) | Name of the day in a week |
dayn | Public | dayn(d) | Number of the day in a week |
delfile | Public | i=delfile(s) | Deletes a file in a file system |
dim | Public | i=dim(p...) | Dimensions of variable arrays |
dir$ | Public | s=dir$ | Directory where the runtime is installed |
eomonth | Public | d=eomonth(d) | Last day of a month |
errl | Public | i=errl | Line number in a script when an error occurs |
errm | Public | s=errm | Error message details |
errmes$ | Public | s=errmes$(i) | Translatable error message |
errn | Public | i=errn | Error number |
errp | Public | s=errp | Error program |
escjson | Public | s=escjson(s) | Character escaping function for "JSON" constants |
evalue | Public | p=evalue(s) | Evaluation of an expression |
evaluesdata | Public | p=evaluesdata(s,p,p) | Evaluation of a "Sdata" expression |
exp | Public | n=exp(n) | Exponential function |
filexist | Public | i=filexist(s,s,s) | Existence of a file |
fac | Public | i=fac(i) | Factorial function |
filinfo | Public | i=filifo(s,i) | Access to file information |
filpath | Public | s=filpath(s...) | File path construction function |
find | Public | i=find(p...) | Finds the first occurrence of a value in a list |
fix | Public | i=fix(n) | Integer truncation |
fmet | New | p=fmet c.METHOD | Calls a method on an instance |
format$ | Public | s=format$(s,p) | Formats a value according to a format description |
freeheap | Public | n=freeheap | Gives free memory available in the object heap |
freemem | Public | n=freemem | Gives free memory in the common memory segment |
freesnapshot | New | i=c.freesnapshot | Method that frees a snapshot |
func | Public | p=func FUNCTION(p) | Calls a function |
gdat$ | Public | d=gdat$(i,i,i) | Constructs a date from day, month, year |
gdatetime$ | Public | dt=gdatetime$(s) | Constructs a datetime from a string |
getBit | Public | b=getbit(i,i) | Extracts out of an integer the value of the bit in the rank i |
getenv$ | Public | s=getenv(s) | Access to variable environment values |
getlogname | Public | s=getlogname | Returns the engine log file |
getmodified | New | i=c.getmodified(p...) | Access to modified properties in an instance |
Getuuid | New | u=getuuid | Returns a UUID |
heapdmp | Public | s=heapdmp | Generates a memory ump file |
instr | Public | i=instr(i,s,s) | First occurrence of a substring in a string from a position |
int | Public | i=int(n) | Integer value function |
left$ | Public | s=left$(s,i) | Left part of a string |
len | Public | i=len(s) | Length of a string |
ln | Public | n=ln(n) | e-based logarithm |
lobsize | Public | n=lobsize(s) | Gives the real size of a LOB |
log | Public | n=log(n) | 10 based logarithm |
max | Public | p=max(p...) | Maximum value in a list |
maxtab | New | i=maxtab(p) | Maximum index in a variable length array |
mess | Public | s=mess(i...) | Translatable messages |
mid$ | Public | s=mid$(s,i,i) | Extracts a substring of a string |
min | Public | p=min(p...) | Minimum value in a list |
mod | Public | i=mod(n,i) | Modulus function |
modified | New | l=p.modified | Checks if a property of an instance has been modified |
month | Public | i=month(d) | Extracts the month number of a date |
month$ | Public | s=month$(d) | Returns the month name from a date |
movfile | Public | i=movfile(s,d) | Moves a file. |
nbrecord | Public | i=nbrecord(p) | Returns count(*) on a database table or cursor |
nday | Public | i=nday(d) | Returns a number of days from a date |
nday$ | Public | d=nday(i) | Returns a date from a number of days |
NewInstance | New | c=Newinstance... | Creates an instance in memory |
not | Public | l=not n | Logical negation |
Null | New | c=Null | Returns a null instance pointer |
Nulluuid | New | u=Nulluuid | Returns a null UUID |
num$ | Public | s=num$(n) | string Decimal representation of a number |
objectexist | Public | n=objectexist(s) | Gives information if the object exists or not |
objectnbs | Public | n=objectnbs(c) | Gives the number of property of an instance |
objecttype | Public | s=objecttyp(c) | Gives the number of string type of an instance |
objectvar | Public | s=objectvar(c) | Gives the "n" property of an instance |
openlog | Public | i=openlog(i) | Opens a log file for the engine |
or | Public | l=n or n | Logical "Or" |
parse | Public | i=parse(s) | Parses a string containing a Sage X3 script expression |
pat | Public | l=pat(s,s) | Checks the conformity of a string against a pattern |
pi | Public | n=pi | "pi" rounded to 32 digits precision (3.14159265358979323846264338328) |
prd | Public | n=prd(n...) | Product of a list of numeric values |
renamefile | New | n=renamefile(s,s) | Renames a file |
reverttosnapshot | New | i=c.reverttosnapshot | Reassigns a class with the snapshot values |
revertupdtick | New | i=c.revertupdtick | Reassigns a class hierarchy with the "Updtick" values from snapshot |
right$ | Public | s=right$(s,i) | Right part of a string |
rnd | Public | n=rnd(n) | Returns a random number between 0 and x |
rowcount | Public | n=rowcount(p) | Performs count(*) on a filtered database table |
seg$ | Public | s=seg$(s,i,i) | Extracts a substring of a string |
setBit | Public | i=setbit(i,i,b) | Sets the one of the bits of an integer to a given value |
sgn | Public | i=sgn(n) | Returns the sign (+1/-1) of a number |
sh | Public | n=sh(n) | Hyperbolic sine function |
sigma | Public | p=sigma(p...) | Performs a sum on expressions based on an index value |
sin | Public | n=sin(n) | Sine function |
space$ | Public | s=space$(i) | Returns a string filled with a given number of spaces |
sqr | Public | n=sqr(n) | Square root function |
strdecode | New | s=strdecode(s,s,i) | Decodes a string format to get ab UCS2 encoded string |
strencode | New | s=strencode(s,s,i) | Encodes a UCS2 encoded string to another format |
string$ | Public | s=string$(i,p) | Returns a string filled with a repeated character or character sequence |
sum | Public | p=sum(p...) | Performs a sum on a list of values |
tan | Public | n=tan(n) | Tangent function |
th | Public | n=th(n) | Hyperbolic tangent function |
time | Public | n=time | Returns the number of second elapsed since the beginning of the day |
time$ | Public | s=time$ | Returns a string giving the current time on the server |
timestamp$ | Public | s=timestamp$ | Returns a string containing the digital representation of a time stamp |
tolower | Public | s=tolower(s) | Transforms the upper case characters in a string into lower case |
toSData | Public | s=toSData(s,s,s) | Transforms an X3 where sentence in a valid SData expression |
toupper | Public | s=toupper(s) | Transforms the lower case characters in a string into upper case |
touuid | New | s=touuid(u) | Transforms a string representation of a "UUID" into a "UUID" |
trtcou | Public | s=trtcou | Returns the name of the current executed Sage X3 script file |
type | Public | i=type(p) | Returns the type of a variable |
unescjson | Public | s=unescjson(s) | Character un-escaping function for "JSON" constants |
uni | Public | i=uni(p...) | Returns the first occurrence of a duplicate value in a list of values |
uniqid | Public | i=uniqid(p) | Returns a sequence unique value for a database table |
uuid$ | New | u=uuid$ | Returns an unique "id" (UUID format), same as "Getuuid" |
val | Public | n=val(s) | Returns a numeric value from a string containing a decimal representation |
var | Public | n=var(n,n,n,...) | Gives the variance of several arguments |
ver$ | Public | s=ver$(i) | Returns a revision number |
vireblc | Public | s=vireblc(s,i) | Space cleaning of a string (leading, trailing, consecutive...) |
week | Public | i=week(d) | Returns the week number from a date |
xgetchar | New | s=xgetchar(s,i) | Extracts a character from a string |
xor | Public | l=n xor n | Logical exclusive "Or" |
year | Public | i=year(d) | Extracts the date from a year |
Deprecated and internal keywords
keyword | Category | Syntax | Definition |
adxcio | Internal | ||
adxioa | internal | ||
adxnfs | Internal | ||
adxpam | Deprecated | ||
adxpid | Internal | ||
adxtyp | Internal | i=adxtyp( ) | |
clactxnbs | Internal | ||
clactxvar | Internal | ||
callstack | Internal | S=callstack(i) | |
clone | Internal | c=c.clone | Clones an instance |
cop$ | Deprecated | ||
dbgbreakpointadd | Internal | ||
dbgbreakpointget | Internal | ||
dbgbreakpointlist | Internal | ||
Dbgbreakpointremove | Internal | ||
Dbgbreakpointupdate | Internal | ||
dbgevalue | Internal | ||
dbgevalue2 | Internal | ||
dimctx | Internal | n=dimctx(s,n) | |
entete | Deprecated | ||
errnremote | Internal | s=errnremote | |
filcom | Internal | ||
filecla | Internal | ||
filelev | Internal | ||
filetyp | Internal | ||
freesyssnapshot | Internal | ||
funciu | Deprecated | ||
getsysmodified | Internal | ||
graph$ | Deprecated | ||
inpmode | Deprecated | ||
IsOpenAdxd | Internal | ||
jsonproto | Internal | ||
maskabr | Deprecated | ||
maskcla | Deprecated | ||
maskcou | Deprecated | ||
masklev | Deprecated | ||
masknam | Deprecated | ||
masknbf | Deprecated | ||
maskrk | Deprecated | ||
masksiz | Deprecated | ||
nbruser | Internal | n=nbruser() | |
progcan | Internal | s=progcan(n ) | |
progldd | Internal | n=progldd(n) | |
progsiz | Internal | n=progldd(n) | |
progusd | Internal | n=progusd(n) | |
pushscript | Internal | n=pushscript(s) | |
pullobject | Internal | n=pullobject(s) | |
pullscript | Internal | n=pullscript(s) | |
reverttosyssnaphot | Internal | i=c.reverttosyssnapshot | |
sysmodified | Internal | ||
tab$ | Deprecated | ||
typectx | Internal | i=typctx(s,n) | |
varinit | Deprecated | ||
varmode | Deprecated |