Data types conversion [examples]

Convert the data type of an expression
CAST
> m_var = "date"
> ? cast("12/12/2005" as (m_var))
12/12/2005
> open database southwind
> select cast(limit-balance as numeric(10,2)) from example

https://www.lianja.com/doc/index.php/CAST()


Return a letter code that represents a data type
TYPE
i = 10
? type("i")
N

https://www.lianja.com/doc/index.php/TYPE()


Return a letter code that represents a data type
VARTYPE

 

i = 10
? vartype(i)
N

https://www.lianja.com/doc/index.php/VARTYPE()


Advertisements

Constants [examples]

String constants

The string type is used for textual characters. There is no type for representing just one character. A string is a series of zero or more characters. You delimit string constants using either a double-quote ” or a single-quote ‘.

myvar = "This is a string"
myvar = 'so is this'

Numeric constants

Numeric types in Lianja are all stored as floating point numbers with zero or more decimal places.

myvar = 10
myvar = 10.5678

You can also define hexadecimal numeric constants.

myvar = 0x0a

Date constants

Date constants are delimited by curly braces.

// set myvar to 10th of october 2009
myvar = {10/10/2009}

Logical constants

Logical (boolean) constants have one of two values, true or false. The result of any logical comparison expression results in a logical type.

myvar = true
myvar2 = false
if myvar or myvar2
    // this will be executed as myvar is true
endif

Currency constants

Currency constants are preceeded by a $.

// set myvar to 1000 dollars
myvar = $1000

Datetime constants

Datetime constants are delimited by curly braces.

// set myvar to 10th of october 2009 at 8.30am
myvar = {10/10/2009 08:30}

https://www.lianja.com/doc/index.php/A_Lianja_Primer


'goodbye'
"LIANJA"
"1234.56"
"12/12/2009"
1234
1234.56
// set date is BRITISH, set century is OFF
{21/01/09}
// set date is AMERICAN, set century is ON
{01/21/2009}
// set date is GERMAN, set century is ON
{21/01/2009}
// set date is JAPAN, set century is ON
{2009/21/01}
// set date is BRITISH, set century is OFF
{21/01/09 02:11:12 PM}
// set date is AMERICAN, set century is ON
{01/21/2009 05:09:09 AM}
// set date is GERMAN, set century is ON
{21/01/2009 11:30:00 PM}
// set date is JAPAN, set century is ON
{2009/21/01 12:10:10 AM}
$123456789.1234
$99

https://www.lianja.com/doc/index.php/Lianja_Variables_and_Constants


 

https://www.lianja.com/doc/index.php/DEFINE

https://www.lianja.com/doc/index.php/IFDEF


 

Constants

Variables each have a type determined by the data they contain. You can initialize variables by assigning constants into them. Constants each have a primitive type and are the building blocks for all data in Lianja

String constants

The string type is used for textual characters. There is no type for representing just one character. A string is a series of zero or more characters. You delimit string constants using either a double-quote ” or a single-quote ‘.

myvar = "This is a string"
myvar = 'so is this'

Numeric constants

Numeric types in Lianja are all stored as floating point numbers with zero or more decimal places.

myvar = 10
myvar = 10.5678

You can also define hexadecimal numeric constants.

myvar = 0x0a

Date constants

Date constants are delimited by curly braces.

// set myvar to 10th of october 2009
myvar = {10/10/2009}

Logical constants

Logical (boolean) constants have one of two values, true or false. The result of any logical comparison expression results in a logical type.

myvar = true
myvar2 = false
if myvar or myvar2
    // this will be executed as myvar is true
endif

Currency constants

Currency constants are preceeded by a $.

// set myvar to 1000 dollars
myvar = $1000

Datetime constants

Datetime constants are delimited by curly braces.

// set myvar to 10th of october 2009 at 8.30am
myvar = {10/10/2009 08:30}

https://www.lianja.com/doc/index.php/A_Recital_Primer