Variables このトピックを印刷 前のページ 1つ上のレベル 次のページ

ホーム >  Code Generator > SPL (Spy Programming Language) >


Any non-trivial SPL file will require variables. Some variables are predefined by the code generator, and new variables may be created simply by assigning values to them.


The $ character is used when declaring or using a variable, a variable name is always prefixed by $. Variable names are case sensitive.


Variables types:


integer - also used as boolean, where 0 is false and everything else is true
object - provided by MapForce
iterator - see foreach statement


Variable types are declared by first assignment:


[$x = 0]


x is now an integer.


[$x = "teststring"]


x is now treated as a string.



String constants are always enclosed in double quotes, like in the example above. \n and \t inside double quotes are interpreted as newline and tab, \" is a literal double quote, and \\ is a backslash. String constants can also span multiple lines.


String concatenation uses the & character:


[$BasePath = $outputpath & "/" & $JavaPackageDir]



Objects represent the information contained in the XML schemas, database structures, text files and mappings. Objects have properties, which can be accessed using the . operator. It is not possible to create new objects in SPL (they are predefined by the code generator, derived from the input mapping), but it is possible to assign objects to variables.




class [=$class.Name]


This example outputs the word "class", followed by a space and the value of the Name property of the $class object.

(C) 2019 Altova GmbH