Introduction

Wlanguage and True functions
TEMPORAL REASONING UNIVERSAL ELABORATION
True-World
http://www.true-world.com/

Release 20140103

TRUE Software uses the W-Language syntax of the software Windev 12 (Pcsoft copyright),
in the procedures of the actions, to dynamically calculate the return values.

This help file contains the main principal functions of the WLanguage used by TRUE.

Windev WLanguage full online help available here:

English
http://help.windev.com/en-US/search.awp?origin=browse&cat=fonctions-wlangage,489

Windev product (free of charge) available here:
http://www.windev.com/windev/WD-Express.htm

French
http://doc.pcsoft.fr/fr-FR/search.awp?origin=browse&cat=fonctions-wlangage,489

Windev product (free of charge) available here:
http://www.pcsoft.fr/windev/WD-Express.htm


List of Flow control commands

Flow control commands

Here are the various flow control commands :

-Conditional statements

SWITCH //Branch to various statements based on the value of an expression

IF //Execute a statement based on a condition

-Iterative statements

LOOP //Endlessly repeat a statement

FOR //Repeat a statement until it reaches a given value

WHILE //Repeat statement based on condition

-Branching statements

GOTO //Jump to a given label


IF

Use

//The IF command enables you to test for a condition and branch to different parts of your code, depending on the result.

age,Elderly,Adult,Child,Baby are int

IF age > 70 THEN
        Elderly += 1
ELSE IF age > 18 THEN
        Adult += 1
ELSE IF age > 4 THEN
        Child += 1
ELSE
Baby += 1
END

Syntax

IF <Condition> THEN
<Statement if condition true>
[ELSE
<Statement if condition false> ]
END

IF <Condition> THEN
<Statement if condition true>
[ELSE <Statement if condition false> ]

IF <Condition> THEN <Statement if condition true>
[ELSE
<Statement if condition false> ]
END

IF <Condition> THEN <Statement if condition true> [ELSE <Statement if condition false>]

-Detailed syntax for 1 to 4

IF //Marks the beginning of the IF statement block.
<Condition> //Condition to test.
THEN //Marks start of code for true condition.
<Statement IF condition True> //Statement to execute if condition is true.
ELSE //Starts statement block for false condition (optional).
<Statement IF condition False> //Statement to execute if condition is false (optional).
END //Marks the end of the IF statement block.

IF <Condition 1> THEN
<Statement if condition 1 true>
[ELSE IF <Condition 2> THEN
<Statement if condition 2 true>
[ELSE IF <Condition 3> THEN
<Statement if condition 3 true>
[...]]]
ENDsyntax for 5

IF //Marks the beginning of the IF statement block.
<Condition 1> //1st condition to test.
THEN //Marks start of code for true condition.
<Statement if condition 1 true> //Statement to execute if 1st condition is true.
ELSE IF //Tests the next condition if the previous condition was false (optional).
<Condition 2> //2nd condition to test (optional).
<Statement if condition 2 true> //Statement to execute if the 2nd condition is true and the first condition is false (optional).
<Condition 3> //3rd condition to test.
<Statement if condition3 true> //Statement to execute if the 3rd condition is true and the 1st and 2nd conditions were false (optional).
END //Marks the end of the IF statement block

Notes

-Combining conditions
//The AND and OR keywords enable you to perform logical operations and to build combined conditions.

title,city is string
BostonMan,NewyorkBoston is int

//For example :
IF city = "Boston" AND title = "Mr." THEN
        BostonMan ++     // Number of man living in Boston
END

IF city = "New York" OR city = "Boston" THEN
        NewyorkBoston ++     // Number of Customer living either in New York or Boston
END

-Conditions using AND and OR are evaluated in their entirety.
//For example:
IF VarA > 10 AND VarB < 20
        VarC=VarA+VarB
END
//Even if the first condition (A > 10) is false, the second condition  (B < 20) will still be evaluated.

-ELSE without IF
//The ELSE keyword cannot be use without the corresponding IF statement.


FOR

Use

//The statement block is repeated by modifying a control variable and comparing it to a limit value before each iteration of the loop.
//The statement block is executed each time the control variable changes value. The control variable changes with the first pass through the FOR loop.

FOR Subscript = 1 TO 10
Array[Subscript] = MyVariable + 10
END

FOR Subscript = 10 TO 1 STEP -1
Array[Subscript] = MyVariable + 10
END

FOR Subscript = 1 TO 5
Trace(Subscript)
END

Aresult(Subscript) //Subscript value is 6

Syntax

FOR <Control variable> = <Initial value> TO <Ending value> [STEP <x>]
//...
END

-Detailed syntax

FOR //Marks the beginning of the loop statement block.
<Control variable> //Simple numeric variable (integer or real).
<Initial value> //Initial value for the control variable (integer or real).
<Ending value> //Ending value for the control variable (integer or real).
STEP //Increment (optional) for the control variable (1 by default).
<x> //Value of the increment (optional) for the control variable (same type as the control variable).
END //Marks the end of the FOR statement block.

Notes

-Code to run
//The code to run appears between the FOR and END statements.

-Step
//The increment of a FOR command must not changed.
//If the increment can vary each time through the loop, a warning message will be generated when compiling the project.

-Exiting from a FOR loop
//Several commands are available :
RETURN // Exits from the FOR loop and exits from the current routine (or procedure).
BREAK // Exits the FOR loop and proceeds with the remainder of the current routine.

-Executing the next iteration
//To directly run the next iteration without running through all the statements of the current loop, use the Continue command:

FOR <Control variable> = <Initial value> TO <Ending value> [STEP <x>]
.. .
IF <Condition> THEN CONTINUE // Returns to the FOR statement
.. .
END

//In this case, the control variable is automatically incremented.


GOTO

Use

//The GOTO command causes an unconditional jump to a specified label.

-Important
//The label must be defined in the same section as the GOTO statement.

Res = Ovalue("Bank")
IF Res <= 0 THEN GOTO ERRBANK
Res = Ovalue("POPULATION")
IF Res <= 0 THEN GOTO ERRPOP
...
RETURN

ERRBANK:
Aresult("No Bank")
RETURN

ERRPOP:
Aresult("no Population")
RETURN

Syntax

...
GOTO <Label name>
...

<Label name>:
<Label statement>

-Detailed syntax

GOTO //Unconditionally execute the code found after the label.
<Label name> //Name of the label identifying the code to be executed.
//The label name must be followed by ":". The label must be found within the same statement block as the GOTO command.
<Label statement> //Code to be run when the label is called with a GOTO command.

Notes

-Label statement
//After executing the label statement the program will execute the statement immediately following the label.

-Restrictions on labels
//You cannot have several labels with the same name within the same routine (or procedure).
//If a label is never called by a GOTO command, a warning will be generated when compiling the project.

-Label and FOR and FOR ALL commands
//The GOTO commands doesn't allow access within a FOR statement.
//The following code will generate a compilation error :
FOR Subscript = 1 TO 10
RestartLabel : Res ++
END
GOTO RestartLabel


LOOP

Use

//The set of instructions is repeated endlessly.
//The number of iterations for the statement block is not set, and there is no expression to evaluate.

Ktime is int

LOOP
        Ktime++
        y= Fvalue("SWITCH",c,Ktime)
        IF y > 50 AND y < 60
                Aresult(3,"Banks = ",y," for time=",Ktime)
                BREAK
        END
END

Syntax

LOOP
...
IF <Condition> THEN BREAK
...
END

-Detailed syntax

LOOP //Indicates the beginning of the instruction set.
BREAK //Exits the block of instructions.
END //Indicates the end of the block of instructions.

Notes

-Code to run
//The code to run appears between the LOOP and END statements.

-Exiting a loop
//Several commands are available :
RETURN // Exits the loop and exits the current subroutine (or procedure).
BREAK // Exits the loop and resume the current subroutine.

-Executing the next iteration
//To directly run the next iteration without running through the code of the current loop, use the CONTINUE command :

LOOP
.. .
IF <Condition> THEN CONTINUE // Returns to the LOOP keyword
.. .
END

-Endless loops
//When compiling your project, loops without an obvious exit statement (missing a BREAK, RETURN statement) are not flagged with a warning.


SWITCH

Use

//The SWITCH command allows for branching on multiple value of an expression.

SWITCH Quantity
CASE 1 : Comment = "Enjoy our promotion: 2 products for the price of one"
CASE 2 : Comment = "Buy two products, only pay for one"
OTHER CASE : Comment = ""
END

SWITCH True
CASE Value = 10 : Trace(10)
CASE 10 < Value < 20 : Trace("Between")
CASE Value > 30 : Trace("Greater than 30")
END

Syntax

SWITCH <Variable>
CASE <Expression 1> : <Statement 1>
CASE <Expression 2> :
<Statement 2>
CASE <Expression 3>
<Statement 3>
CASE <Expression 4>, <Expression 5> : <Statement 4>
CASE <Expression 6>, <Expression 7> :
<Statement 5>
CASE <Expression 8>, <Expression 9>
<Statement 6>
//...
[
OTHER CASE[S] : <OTHER CASE statement>
//or
OTHER CASE[S] :
<OTHER CASE statement>
//or
OTHER CASE[S]
<OTHER CASE statement>
]
END

-Detailed syntax

SWITCH //Marks the beginning of the statement block.
<Variable> //Comparison variable (any type).
CASE //Different comparison statements.
<Expression N> //Value to compare with <variable> (must be of same type).
<Statement N> //Statement to execute if the CASE expression is equal to the <variable> value. After running the CASE statement, execution continues with the statement found immediately after the END command.
OTHER CASE[S]
<OTHER CASE(s) statement> //Statement to be executed if <variable> never matches any of the CASE expressions (optional).
END //Marks the end of the SWITCH statement block.

Notes

-Keyword OTHER CASE
OTHER CASE // must be the last statement used in the SWITCH statement block (before the END command).


WHILE

Use

//In a WHILE statement the condition is tested at the beginning of each pass through the loop.
//As long as the condition remains true, the WHILE loop will continue.
//The program will exit the WHILE loop when the condition becomes false.

list,name is string

ValueWrite("Name","John"+TAB+"James")
list = ValueRead("Name")

WHILE name <> "James" AND name <> EOT
        y = y + 1
        name = ExtractString(list,y,TAB)
END

Syntax

WHILE <Condition>
<Statement if condition true>
END

-Detailed syntax

WHILE //Marks the beginning of the loop statement block
<Condition> //Condition to test.
<Statement if condition true> //Statement to execute if condition is true.
END //Marks the end of the WHILE statement block.

Notes

-Code to execute
//The code to execute is found between the WHILE and END commands.

-Exiting a WHILE loop
//Several commands are available :
RETURN // Exits from the WHILE loop and exits from the current subroutine (or procedure).
BREAK // Exits the WHILE loop and proceeds with the remainder of the current subroutine.

-Endless loops
//When compiling your project, a WHILE loop without an obvious end (no BREAK, RETURN command) will not be flagged with a warning.

-Executing the next iteration
//If you want to run the next iteration of the loop without executing the remaining code of the current iteration, use the Continue command :
WHILE <Condition>
.. .
IF <Condition> THEN CONTINUE // Go back to the WHILE keyword
.. .
END

-Combining conditions
//The AND and OR keywords enable you to perform logical operations and to build combined conditions.
//For example:
WHILE Price < 100 AND ProductType = "AA"
        NumProduct ++
// Number of products whose price is lower than $100 and whose type is "AA"
END

WHILE ProductType = "AAA" OR ProductType = "AA"
        NumProduit ++
// Number of products of type "AA" and "AAA"
END

-Conditions using AND and OR are evaluated in their entirety.
//For example:
A > 10 AND B < 20
//Even if the first condition (A > 10) is false, the second condition (B < 20) will still be evaluated.


List of Simple commands

Simple commands

Here are the various simple commands :

CONTINUE //Returns to the top of the loop without executing the remaining statements

RETURN //Exits statement and current subroutine (or current procedure)

BREAK //Exits statement and proceeds with remainder of the current routine


BREAK

Use

//The BREAK command exits from the current loop and executes the rest of the current subroutine.

//The BREAK command can be used in the following loop statements :
FOR
LOOP
WHILE

-Note :
//The BREAK command cannot be used to exit from a subroutine (procedure).
//Use the RETURN keyword instead.

Syntax

-FOR statement
FOR <Control variable> = <Initial value> TO <END value> [STEP <x>]
...
IF <Condition> THEN BREAK
...
END
<Statements>

-LOOP statement
LOOP
...
IF <Condition> THEN BREAK
...
END
<Statements>

-WHILE statement
WHILE <Condition>
...
IF <Condition> THEN BREAK
...
END
<Statements>

//In all the cases, if <Condition> is true, the following events happen:
//Exit the loop statement block.
//Execute the remaining statements of the subroutine.

Notes

-Other command used to exit from a loop :
RETURN // Exits from the loop and from the current subroutine (procedure).


CONTINUE

Use

//The CONTINUE command enables you to go back to the beginning of the next iteration without processing the code of the current iteration.

//The CONTINUE command can be used in loops of the following type :
FOR
LOOP
WHILE

Syntax

-FOR statement
FOR <control variable> = <initial value> TO <final value> [STEP <x>]
.. .
IF <Condition> THEN CONTINUE
.. .
END

-If <Condition> is true :
//The code following the CONTINUE command is not executed.
//The loop statement is executed directly from the beginning of the FOR command.
//The <control variable> is incremented.

-LOOP statement
LOOP
.. .
IF <Condition> THEN CONTINUE
.. .
END

-If <Condition> is true:
//The code following the CONTINUE command is not executed.
//The loop statement is executed directly from the beginning of the LOOP statement.

-WHILE statement
WHILE <Condition 1>
.. .
IF <Condition 2> THEN CONTINUE
.. .
END

-If <Condition 2> is true:
//The code following the CONTINUE command is not executed.
//The loop statement is executed directly from the beginning of the WHILE statement.

-Example of what not to do:
//In the following code the CONTINUE keyword prevents the execution of the i++ statement:
i= 1
WHILE i < 10
IF i=5 THEN CONTINUE
Aresult("i="+i)
i++
END


RETURN

Use

//The RETURN command enables you to exit from a statement block and exit the subroutine (or procedure).

//You can use the RETURN command in :
FOR // statement.
LOOP // statement.
WHILE //statement.

Syntax

-FOR statement
FOR <Control variable> = <Initial value> TO <END value> [STEP <x>]
IF <Condition> THEN RETURN
END

-LOOP statement
LOOP
...
IF <Condition> THEN RETURN
...
END

-WHILE statement
WHILE <Condition 1>
...
IF <Condition> THEN RETURN
END

-In all the cases, if <condition> is true the following events happen:
//Exit the loop statement block.
//Exit the current subroutine (or procedure).

Notes

-Other command used to exit from a loop
BREAK // Exits from the loop and executes the remainder of the current procedure.


Operator list

Here are the various operators :

Logical_operators
AND, OR , NOT

Arithmetic_operators
+, -, *, /, ++, --, +=, -=

Binary_operators
BinaryAND, BinaryOR , BinaryNOT , BinaryXOR

Comparison_operators
=, ~=, <>, <=, >=, <, >

Character_string_operators
+, [[ , ]]

Punctuation_operators
( ) [ ] , . : ; .. ... //


Arithmetic operators

Use

//Here are the arithmetic operators:
+ // Addition (numerical value or string).
- // Subtraction (numerical value).
* // Multiplication.
/ // Division.
++ // Increment (numerical value).
-- // Decrement (numerical value).
+= // Addition of a value to the variable or the control (numerical or text).
-= // Subtraction of a value from a variable or a control (numerical).

-Rules

//Calculation rules
//Calculations are performed without loosing precision or truncating values.
//Overflow checks are performed at the time the result is assigned into the variable.

Notes

-Displaying results
//You cannot directly display results from calculations that use the following operators:
++ // Increment.
-- // Decrement.
+= // Adding a value to a variable or control (numerical or text).
-= // Subtracting a value from a variable or a control (numerical).

-The following example would produce a compilation error:
n is int = 10
Trace(n+=1)

-To display the result modify the example as follows:
n is int = 10
n += 1
Trace(n)

-Equivalence
j ++ // is equivalent to
j = j + 1

j -- // is equivalent to
j = j - 1

j += 3 //is equivalent to
j = j + 3

j -= 3 //is equivalent to
j = j - 3

-It is better to use the syntax :
j ++, j --, j += , j -=
// it is faster than the usual syntax.


Binary operators

Use

//Operations performed on binary values are available only through W-Language functions.

//These functions are :
BinaryAND
BinaryOR
BinaryNOT


Comparison operators

Overview

//Comparison operators can be classified in different categories:

-Equality
= //Strict equality
~= //Flexible equality
~~ //Very flexible equality:

-Comparison
<> //Not equals
<= //Less than or equals
>= //Greater than or equals
< //Less than
> //Greater than

-Comparison interval
< < //Strictly between (and vice versa)
< <= , <= < //Between (and vice versa)
<= <= //Between (including both ends) (and vice versa)

//Comparison operators can be used with any type of operands.
//The result of a comparison expression is a boolean.

Detail

-Flexible and very flexible equality
//Flexible equality (~=) and very flexible equality (~~) only operate on character strings (except for fixed strings).
//These operators enable you to:
//not differentiate between lower case and upper case characters,
//not take into account spaces found before or after the string to test,
//not take into account accented lower case characters,
//not take into account spaces and punctuation inside character strings (very flexible equality only)

"Smith" = "SMITH" // returns False
"Smith" ~= "SMITH" // returns True
" Smith" ~= "SMITH" // returns True
" Smith" ~= "Smith" // returns True
"Crème brulée" ~= "Creme brulee" // returns True
"U.S.A." ~~ "USA" // returns True

-Equality and comparison: Real numbers different by more than 6 decimals
//The equality test for real numbers only takes into account the first 6 decimals.
//Rounding errors due to the internal coding of reals require a specific test.

//This test is done by comparing the difference between the two values to be tested with a reference value.
//This reference value can be equal to 0.00001 or less.

//This rounding management is not specific to WinDev.
//It is common to programming languages handling reals in binary format.

Diff, R1, R2 are reals
Diff = 0.00001
IF Abs(1-(R1/R2)) < Diff THEN
// R1 and R2 are equal
ELSE
// R1 and R2 are different
END

-Comparison intervals
//Comparison intervals enable you to simplify the statements for complex comparisons.
//For example, the following line
IF x > 5 AND x < 10 THEN ...
//can be replaced by
IF 5 < x 10 THEN

MyArray is array of 5 strings
I is int
MyArray[1] = "Doyle"
MyArray[2] = "Anderson"
MyArray[3] = "Peterson"
MyArray[4] = "Martin"
MyArray[5] = "Field"

FOR I = 1 TO 5
IF "B" < MyArray[I] <= "M" THEN Trace(MyArray[I])
// displays Doyle and Field
END


Punctuation operators

Overview

//The miscellaneous operators category comprises the following operators:

( ) //Parentheses
[ ] //Square brackets
, //Comma
. //Period
: //Colon
; //Semicolon
.. //Double period
... //Triple period
// //Double slash

Detail

-Parentheses
//Parentheses enable you to:
//group different parts of an expression while indicating the priority order.
//For example :
IF ( A-B ) * 5 THEN ....

//specify the various parameters for a TRUE function.
//For example :
Ovalue("Banks",c,t)

-Square brackets
//Brackets are used for indexing.
//They allow for easy addressing of indexed objects.
//For example :
MyArray is an array of 5 strings
MyArray[1] = "Smith"

-Comma
//Commas enable you to separate :
//declaration of several variables of the same type written on the same line.
//For example :
MyExample1, MyExample2 are strings
//various parameters passed to a TRUE function.
//For example :
Ovalue(Bank, c, t)

-Semicolon
//Semicolons enable you to separate several statements written on the same line.
//For example :
I, J are integer ; MyString is string

-Colon
//Colons enable you to access objects members and methods.
//Double colons (::) enable you to access GLOBAL members and GLOBAL methods for a class.

-Period
//Periods enable you to access sub-elements. Here are some examples :
//access a window's control: MyWindow.DateInputControl
//access a window's global variable: MyWindow.gLength
//access a file's Item: Client.Name
//access a table's column: Table.Column1

-Double period
//Double periods enable you to access the property for a control, window, report, file, item, variable. Here are some examples:
ScrollBar..Bormax = 200
ShippingCharge..Title = "Shipping charges data entry window"
MyReport..BottomMargin = 20
MyFont..Name = "Arial"

-Triple period
//The triple period operator ( "...") enables you to continue a logical line onto the next physical line. For example:
IF (FamilyCode="LV") AND ...
(FamilyCode="MO") THEN
Process
END

Caption = "Please enter the " + ...
"client name."
//The tri." can only be used at the end of a line and not in the middle.
//No character can follow a triple period "..." (except for comments).

-Double slash
//Double slash marks the start of a comment.
//The text following the double slash is not compiled nor executed with the project. For example:
// Perform a find operation within a string
// Declaration
MyString is string = "WinDev is great"
// Test

IF Position (MyString, "W")<>0 THEN
Aresult("found") // Display result
END


Logical operators

Use

//The logical operators are :
AND // logical multiplication.
OR // logical addition.
NOT // logical negation.

//Logical operators enables you to perform logical operations and to build conditional statements.

IF Client.City = "Boston" AND Client.Title = "Mr." THEN
BostonMan ++ // Number of men living in Boston
END

IF Client.City = "Boston" OR Client.City = "New York" THEN
BostonNewYork ++ // Number of clients living either in Boston or in New York
END

Rules

True AND True // returns True
True AND False // returns False
True OR True // returns True
True OR False // returns True
NOT True // returns False

Notes

-Numerical variable
//If a numerical value is used as a logical operator (boolean), "0" is equivalent to false.
//Any other value is equivalent to true.
//For example, the following two lines of code are equivalent :
IF NumTest THEN ...
IF NumTest <> 0 THEN ...
//The first syntax (IF NumTest THEN) is better than the second one.

-String variable
//If you try to use a character string as a logical operator it will result in a W-Language error.
//For example, the following syntax will produce an error :
IF TestString THEN // will produce an error at run time (but not at compilation time).

-Priority
//The AND and OR operators have the same precedence.
//If you want to prioritize them you need to use parentheses.
//For example:
IF (A = 2 AND B > 3) OR (A = 2 AND B < 0) THEN ...


Character string operators

Use

//Character strings can be handled by specific W-Language functions or by the operators +, [[ and ]].
//Character string operators are:
+ // concatenates strings.
[[ , ]] // (opening double bracket and closing double bracket) : extraction operator for a sub-string.

Text = "Programming Guide"
Text[[13]] // Returns "G"
Text[[13 TO 17]] // Returns "Guide"
Text[[13 TO]] // Returns "Guide"
Text[[TO 11]] // Returns "Programming"
Text[[13 on 5]] // Returns "Guide"
Text + " for WinDev" // Returns "Programming Guide for WinDev"

Notes

-[[ and ]]
//The [[ and ]] operators enable you to extract or replace a sub-string.
//Some examples:
ExtractString[[<Position>]] // Extracts a character within a string based on its position in the string.
ExtractString[[<Position>]] = <new string> // Replaces the character found in the string with the new string.
ExtractString[[<Start> TO <END>]] // Extracts a character string from the <Start> to the <End> positions.
ExtractString[[<Start> TO]] // Extracts a character string starting from the <Start> position to the end of the string.
ExtractString[[TO <END>]] // Extracts a character string from the beginning of the string to the <end> position in the string..
ExtractString[[<Start> on <Number>]] // Extracts the specified number of characters from the <Start> position.

-Caution :
//Be careful with your syntax when using the [[ and ]] operators in procedures modifying character strings.
//You could inadvertently modify your character strings.

-Position in a character string
//The first character is in position 1 (not in position 0).
//The Position function returns the start position of a specified character string within another character string.

-W-Language functions
//You can also handle character strings using the following functions:
Right
Left
Middle
Character strings


Simple data types

Principle

//A variable is defined by its name and its data type.
//The type of the variable determines what value the variable can take, its memory footprint and the available operations.

-Reminder :
//Each type is identified by a keyword of the W-Language. These keywords are reserved words.

Type of variables

//Here are the "simple" types of the W-Language (these types can be declared directly, see Variable declarations) :

boolean // Type advisable for all logical operations where only 2 alternatives are possible:
True //(Value different from 0)
False //(Value equals 0)
//Example :
b is boolean

Integer // type recommended for calculations performed on integer value.
//For more advanced calculations, the W-Language offers different types of integer .
//Example :
b is int

currency // type recommended for calculations on real values needing a guarantee of absolute precision for decimals, for example currency values.
//A currency types has 24 significant digits (18 maximum for the integer part, 6 maximum for the decimal part).
//Precision is available up to 6 decimals.
// More details regarding the currency type .
//Example :
MyCurrency is currency

real // type recommended for simple calculations performed on real values.
//A real manages 15 significant digits, but the precision of the decimals is not guarantee.
//If you want to perform precise calculations used the "Currency" type.
//For advanced calculations, the W-Language offers different types of reals .
//Example :
SalesTax is real

string // type recommended for managing characters and character strings.
//With this type, you don't need to declare the length of the string.
//It can freely vary when using the variable.
//For the advanced management of character strings (mainly for the Windows API), the W-Language offers different types of strings.

Date, Time, DateTime, Duration // types recommended for managing dates and time.
//The "Date" and "Time" types enable you to easily manipulate dates and times, and to almost automatically manage all the conversions.
//More details on the Date type and More details on the Time type.
//The "DateTime" type allows you to manage a date and a time all at once.
//More details on the DateTime type.
//The "Duration" type enables you to easily manage the difference between several dates and times.
//More details on Duration.

Variable declaration

-Declaring a variable
<Variable name> is <Type>

-Declaring several variables
<Variable name 1>, 2> are <Type>

-Detailed syntax
<Variable name> //Name of the variable to declare.
<Type> //Type of the variable, or common to all variables being declared.
//Note : the keyword a is not required ; it is used for readability only.

Notes

-Plural for variable types
//All the variable types can be written in the plural form.
//For example, string or strings, real or reals, etc.
//Note : Int is the same in the singular and the plural form.

-Limit values for data types
//If a variable is assigned a value outside the limits of its type :
// no error message is generated, the value for the variable is invalid.


Declaring a simple data type

Use

//A simple variable is a scalar variable (integer, boolean, etc.), real or character string.

Syntax

-Declaring one or more variables
<Variable name> is <Variable type>
//or
<Variable 1 name>, <Variable 2 name> are <Variable types>

-Detailed syntax
<Variable name> //Name of the variable to declare.
<Variable type> //Variable data type. See the different variable types.
<Variables types> //Type common to the variables.
//See the different variable types.

ClientName is string
Counter is int
Price is real
i,j,k are int

-Declaring and initializing a variable
<Variable name> is <Variable type> = <Value>
//or
<Variable name> is <Variable type>
<Variable name> = <Value>

-Detailed syntax
<Variable name> //Name of the variable to declare.
<Variable type> //Variable type. See the different variable types.
<Value> //Value to assign to the variable.
//Note : When several variables of the same type are declared and initialized on the same line, only the last variable is initialized.

ClientName is string
ClientName = "Smith"
Counter is int = 7
i,j,k are int = 21
// Only k is initialized to 21

Restrictions

-Declaring variables with the same name
//You cannot use variables with the same name within the same subroutine (regardless of the variables types).
//If variables with the same name are declared in different subroutines of the project, the variable precedence rule applies.


Constant

Use

//Constants are elements of the language whose value is fixed once and for all. Their value cannot be modified later in the program.

Syntax

-Declaring one or more constants

CONSTANT
<Name of CONSTANT 1> = <Value 1>
<Name of CONSTANT 2> = <Value 2>
END

-Detailed syntax

CONSTANT //Indicates the beginning of the constant declaration block.
<CONSTANT name> //Name of the constant to be declared.
<Value> //Value of the constant.
END //Indicates the end of the constant declaration block.

CONSTANT
SalesTax = 7.6
END

Notes

-Declaring constants
//Constants must be declared in:

//project initialization code so they can be used in all the subroutines found in the project (project code, windows code, controls code, procedures, etc.)

//window global declaration code so they can be used when processing the windows code (window code, code for the controls found in the window, local procedures, etc.)

//report opening code so they can be used in all the report subroutines (report code, code for the controls found in the report, local procedures, etc.)

//class declaration code so they can be used in the class.
//- To access this constant from one of the class methods use the following syntax: "::<Constant name>".
//- To access this constant from source code outside of the class, use the following syntax: "<Class name>::<Constant name>".

-Note :
//Constants are always global in reference to:
//a project.
//a window.
//a report.
//or a class.

Restrictions

-Declaring constants with the same name

//Within a subroutine you cannot define several elements (variable or constant) bearing the same name.

//Within a project, if a constant and a variable have the same name:
//- the variable will be used within the subroutine in which it was declared and in all the related subroutines.
//For example, the variable is declared in the source code for clicking on a button. When clicking on the button this variable is passed as a parameter to the local procedure. This variable will then be used in this local procedure.
//- the constant will be used in all the other routines.

//If a "global" constant for a project and a "global" constant for a window have the same name:
//- the constant "global" to the window will be used in all the window management section as well as the controls and procedures local to the window.
//- the constant "global" to the project will be used in all the other routines.

-Declaring a member of type constant
//You cannot define a constant type member in :
//a structure. //a composite variable.


Structure

Use

//A structure is a type of abstract data defined by the programmer. A structure comprises elements of different types.

-Note :
//If you use personalized variables, it is advised that you declare:
//A structure type, if several variables of this type are used in various part of your project.
//A composite variable, if you only use one variable of the type in your project.

Syntax

-Declaring a structure

<structure name> is structure
<structure members>
END

-Detailed syntax

<structure name> //Name of the structure to declare.
<structure members> //Declaration of the variables contained in the structure.
//These variables are called the members of the structure.
END //End of variable declaration.

ProductRef is a structure
CodeF is int
CodePr is fixed string on 10
END

-Declaring a structure type variable

<Variable name> is [a] <structure name>

-Detailed syntax

<Variable name> //Name of the structure type variable to declare.
<structure name> //Name of a structure previously declared.

ProductRef is a structure
CodeF is int
CodePr is fixed string on 10
END

Armchair is ProductRef

-Using members of a structure type variable

<structure variable name>:<structure member name>

-Detailed syntax

<structure name> //Name of the structure variable to use.
<structure member name> //Name of the structure member to use.

ProductRef is a structure
CodeF is int
CodePr is fixed string on 10
END

Armchair is ProductRef
Armchair:CodeF = 7
Armchair:CodePr = "Furniture"

Notes

-Declaring structures
//If a structure <structure name> is declared:
//in project code, you can declare <structure name> type variables in the entire project.
//in window global declaration code, you can declare a <structure name> type variable in this window, in the window controls and in the associated local procedures.
//in report opening code, you can declare a <structure name> type variable in the report, in the report controls and in the associated local procedures.
//in class declaration code, you can declare a <structure name> type variable in the class and in the class methods.
//in a process, you can declare a <structure name> type variable in the subroutine.

-Structure members type
//Members of a structure can be of the following
Int // (Integer) (or selected from complex int).
real //(or selected from complex real).
currency
string //(or selected from complex string).
array //( "simple" array, dynamic array or fixed array).
//All other data types are not allowed (composite variables, constant, etc.).

-Declaring a structure member of array type
//Declaring a simple array type member:
//The array dimensions are fixed when it is declared.
//You can modify the dimension of the array using the Dimension function.

//Declaring a dynamic array member:
//You need to set the dimension of the array (in other words, allocate the array) before using it.
//For example:
// Declaring a structure
Struct is structure
x1 is int
x2 is dynamic array // Declaring the array
END

// Declaring a structure type variable
MyStruct is Struct
// Assigning the array
MyStruct:x2 = new array of 4,7 int
// using the array
MyStruct:x2[1,1] = 25

Restrictions

-Restrictions applying to structures
//Structure inheritance is not allowed : a structure cannot inherit from another structure.
//You cannot restrain access to a member of a structure: all structure members are public.


Array

Use

//An array is a structure data type that enables you to group a series of elements of the same type.
// Each array element is directly accessible through its Subscript.

//You can change the dimension of an array in your program using the Dimension function.

-Note :
//The Array keyword defines a "simple" array.
//There are two other kinds of "advanced" arrays :
dynamic array // array allocated on demand.
fixed array // Fixed size array (recommended for Windows API).

Syntax

-Declaring a "simple" array

<array name> is an array of <Dimension 1> [by <Dimension 2>]...[by <Dimension 10>] <Data type of array elements>
//or
<array name> is an array of <Dimension 1> [,<Dimension 2>]...[,<Dimension 10>] <Data type of array elements>

-Detailed syntax

<array name> //Name of the array variable to declare.
<Dimension 1>...<Dimension 10> //Dimension 1 to 10 of the array (integer value).
<Data type of array elements> //Data type of the elements that make up the array.
//See various variable data types.

//Note: The an keyword is not required, it is used for readability only.

ClientArray is an array of 5 by 7 by 3 int
// Equivalent to :
ClientArray is an array of 5,7,3 int

// Modifying the array dimension
Dimension(ClientArray,7,9,4)

-Referring to a "simple" array

//Referring to an element in a one dimensional array:
<array name>[Subscript]

//Referring to an element in a two dimensional array:
<array name>[Subscript1, Subscript2]
//or
<array name>[Subscript1][Subscript2]

//Referring to an element in a Nth dimensional array:
<array name>[Subscript1,...,SubscriptN]
//or
<array name>[Subscript1]...[SubscriptN]

-Detailed syntax

<array name> //Name of the array to use.
<Subscript1> //Element Subscript for the 1st dimension.
<Subscript2> //Element Subscript for the 2nd dimension.
<SubscriptN> //Element Subscript for the Nth dimension (N <= 10).

//Note: You cannot manipulate an entire array all at once.
//For example, you cannot assign an array to another array.

ClientArray[2,5,3] = 47
// Equivalent to :
ClientArray [2][5\cf3 ] = 47

Notes

-Dimension of a "simple" array
//The Dimension functions enables you to:
//know the number of elements in an array.
//modify the dimension of an array.
//Caution : The Dimension function doesn't allow you to modify the number of dimensions of an array.

Restrictions

-Elements of a "simple" array
//An array cannot consist of :
//- composite variables.
//- arrays.

-Declaring variables with the same name
//You cannot have several variables with the same name within the same subroutine (regardless of the variables types).
//If variables with the same name are declared in various project subroutines, then the variables precedence rule applies.


Composite variables

Use

//A composite variable is made up of elements of different types (members).

-Note :
//If you use personalized variables, it is better to declare :
//a composite variable, if only one variable of this type is used in your project.
//a structure type, if several variables of this type are used in different subroutines in the project.

Syntax

-Declaring a composite variable

<Variable name> is composed of
<Composite variable members>
END

-Detailed syntax

<Variable name> //Name of the composite variable to declare.
<Composite variable members> //Declaration of the variables that make up the composite variable. These variables are called members of the composite variable
END //End of the composite variable declaration.

ProductRef is composed of
CodeF is int
CodePr is character string on 10
END

-Using members of a composite variable

<Variable name>.<Member name>

-Detailed syntax

<Variable name> //Name of the composite variable to use.
<Member name> //Name of the member element to use.

ProductRef.CodeF = 7
ProductRef.CodePr = "Screen"

Notes

-Using a composite variable
//A composite variable can be used without referring to its members.
//For example:
CompositeVar is composed of
Member1 is fixed string on 8
Member2 is fixed string on 12
END

St = CompositeVar // St is built by concatenating all the members of the composite variable
CompositeVar = St // St is transferred into the composite variable

-Data type of composite variable members
//Members of a composite variable can be of the following types:
Integer // (or one of the complex integers).
real // (or one of the complex reals).
currency .
fixed string, ASCIIZ string OR Pascal string.
structure .
array // ( "simple" array, dynamic array or fixed array).
//All the other data types (string, constant) are not allowed.

-Declaring a composite variable member of array type
//Declaring a member of simple array type :
//The array dimensions are fixed when declaring the array.
//You can modify the dimensions of the array using the Dimension functi
//Declaring a member of dynamic array type :
//You must define the dimensions of the array (in other words, allocate the array) before you use the array.
//For example:
// Declaring a composite variable
MyCompVar is composed of
x1 is int
x2 is dynamic array // array declaration
END

// Allocating the array
MyCompVar.x2 = new A dynamic array of 4,7 integers

// Initialising the array
MyCompVar.x2[1,1] = 25

Limits

-Composite variable limits
//You cannot :
//directly assign a composite variable to another composite variable : you must assign each member individually.
//compare two composite variable.
//pass a composite variable as a parameter to a procedure.
//define inheritance in a composite variable.
//restrict access to a composite variable member : all the members of a composite variable must be public.


Handling character strings

Overview

//WinDev lets you perform several types of operations on character strings by using W-Language functions.

//You can:
//work with the content of the string,
//perform conversion and encryptions.

Modifying the content of a string

//The W-Language functions let you extract part of a string (functions Left, Right or Middle for example)
//as well as perform searches inside a character string (functions Position or Replace for example).

//Some of the W-Language features are also available by using the W-Language string operators.

Performing conversion and encryptions.

//Several W-Language functions let you simplify conversions and encryptions of character strings.
//You can for example:
//convert a character string into its phonetic equivalent (function Phonetic).

-Note :
//For all the String/Date or String/Time conversions, see Using Dates and Times.

-For more details, see:
//Functions used to manage character strings
//W-Language operations on character strings


W-Language functions

Functions used to manage character strings

AnsiToOem //Converts a character string in ANSI format (Windows) into a character string in OEM (DOS) format

Asc //Calculates the ASCII code of the specified character (the ASCII code used corresponds to the ANSI norm used by Windows)

Charact //Returns the character corresponding to the specified ASCII code (the ASCII code used corresponds to the ANSI norm used by Windows)

StringCompare //Compares two character strings

StringBuild //Builds a character string based on a format and some parameters

StringFormat //Formats a character string according to the options chosen

StringCount //Calculates the number of occurrences of a specific character string in another character string

StringRetrieve //Recovers a character string from an external format (C, and so on).

StringToDate //Transforms a date in character string format into a date in the YYYYMMDD format

Complète //Returns a character string in a given size (this string may be truncated or completed with blank space - or any other character - to reach the required size)

CompleteDir //Adds if necessary the "\" character at the end of a character string

Crypt //Encrypts a character string in binary or ASCII format

Uncrypt //Decrypts a character string previously encrypted by the Crypt function

Right //Extracts the right part of a character string (i.e. the last characters)

ExtractString //Extracts a sub-string from a character string based on a given string separator

Left //Extracts the left part of a character string (i.e. the first characters)

Reverse //Returns for each character of a string the complement to 255. (the character string is reversed)

Upper //Converts a character string into uppercase based on the localization parameters defined in Windows

Middle //Extracts a sub-string from a given position in a string

Lower //Converts a character string into lowercase based on the localization parameters defined in Windows

NumToString //Transforms a numeric (integer, real or currency) into a character string of the specified format

OemToAnsi //Converts a character string in OEM format (DOS) into a character string in ANSI (Windows) format

Phonetic //Detects if two character strings are phonetically similar (based on French phonetics)

Position //Searches for the position of a character string inside another character string

PositionOccurrence //Searches for the Xth position of a character string inside another character string

Replace //Replaces all the occurrences of a word found in a string by another word

RepeatString //Concatenates N repetitions of the same character string

NoAccent //Transforms the accented characters of a character string into non accented characters

NoSpace //Returns a character string without spaces on the right or on the left

Lenght //Returns the size of a character string (number of characters)

Val //Returns the numeric value of a character string (this way you can perform numeric calculations on character strings)


Working with XLS files

Manipulez vos fichiers XLS

Overview

//W-language offers a set of functions for working with your ".XLS" files.
Using these functions, you can retrieve all the data entered in Excel.

These functions enable you to:

work with ".XLS" files: opening and closing.

get the information about your ".XLS" files located on the first worksheet: cell data, number of rows, number of columns, type of column, column's title (see diagram).

find out the which Excel version is used.

identify the errors that occurred when working with an ".XLS" file.

Examples

//For more details, see :


XLS functions

Working with ".XLS " files

xlsClose //Closes an XLS file

xlsOpen //Opens an XLS file

xlsOpenExport //Opens an XLS file in the Export directory of the current model

Retrieving data

xlsData //Retrieves the data from a cell of the XLS file

xlsNbColumn //Returns the number of columns in an XLS file

xlsNbRow //Returns the number of rows in an XLS file


Financial functions

FinRedemption //Creates a redemption matrix for a fixed rate loan over a defined time period.

FinDecreasingRedemption //Calculates the value of the amortization of a good over a specific period of time using the decreasing fixed rate amortization formula.

FinLinearRedemption //Calculates the value of a linear amortization of a good over a given period of time

FinError //Returns the number for the last error caused by a financial function

FinPeriodInterest //Calculates for a given period the amount of interests due for paying off a loan by fixed periodical payments with a fixed interest rate

FinPaymentNb //Returns the number of payments required to reimburse the capital based on a given rate

FinInterestRate //Calculates the interest rate for a loan over a given length of time with fixed payments

FinCurrentVal //Returns the current value of an investment

FinNetCurrentVal //Returns the current net value of an investment based on variable financial flows

FinFuturVal //Returns the future value of an investment (regular fixed payments with fixed interest rate)

FinRepayVal //Returns the amount of each regular payment of an investment with fixed interest rate and payment


Matrix

Matrices

Overview

//WinDev offers a set of functions for working with matrices.
//Matrices are mathematical tools used to simplify and solve many problems.
//Matrix calculations are used in many fields: economy, physics, and so on.

//In these fields, problems can often be formulated as a set of equations.
//The result of this set of equations can be calculated using matrices.

Definition

//A matrix is a set of organized data, with "n p" numbers, usually represented as a table with n rows and p columns.
//The numbers that make up the matrix are the matrix elements.
//Each element is identified by its row and column.
//A value is associated with each element.

//In this matrix, n=2 rows, and p=4 columns. The value of the element (row 2, column 3) is 7.

//The dimension (or size) of the matrix corresponds to the number of rows and number of columns of the matrix.
//WinDev lets you generate your matrices size dynamically.
//This is because when a matrix is created it is empty : it contains 0 row, and 0 column.
//It's a matrix of dimension 0 x 0.
//Simply initialize an element on row n and column p, for the matrix size to become n x p.
//For example, after initializing a element in row 6 and column 12, the matrix size becomes 6 x 12.

How to work with matrices?

//To manage your matrix, WinDev offers 20 W-Language functions.
//These functions enable you to :
//work with matrices: create, copy, reverse, compress, delete.
//initialize matrix elements.
//read the value of matrix elements.
//perform various calculation on matrices: add, multiply, transpose, determinant, and so on.
//get various information about matrices: number of rows, number of columns, and so on.

//For more details, see:


Matrix management functions

Using a matrix

MatStack //Compresses the amount of memory space occupied by the matrix.

MatCopy //Creates a copy of a matrix

MatCreate //Creates a matrix

MatInvert //Reverses a square matrix

MatDelete //Deletes an existing matrix

Initializing a matrix elements

MatWrite //Writes an element into a matrix

MatFill2 //Initializes all the elements of a given size matrix

Reading the value of a matrix elements

MatRead //Reads the value of a matrix element

MatReadColumn //Reads the value of all the elements of a matrix column

MatReadLine //Reads the value of all the elements of a matrix row

Matrix calculation

MatAdd //Adds two matrices with the same dimension

MatDéterminant //Calculates the determinant of a matrix

MatMultiply //Multiplies two matrices

MatFloatAdd //Adds a value to each matrix element

MatFloatMultiply //Multiplies each matrix element by a value

MatTranspose //Calculates a matrix transposition

Information about a matrix

MatExist //Tests if a matrix exists in memory

MatNbRow //Returns the number of columns in a matrix

MatNbLine //Returns the number of rows in a matrix

Matrix errors management

MatError //Identifies the type of the last error triggered by a matrix management function


Statistics

Overview

//WinDev offers a set of functions for calculating various statistics.
//Statistics are calculated using matrices.
//The values taken into account for calculating the statistics are the values of the elements of a matrix.
//The series of values are a row (or a column) of the matrix.

//For example, the values of row 1 for this matrix are 3, 2, 4, 5 and 6.

//For more details, see:
//The statistical functions


Statistical functions

StatCorrélation //Calculates the correlation coefficient between two series of values.

StatCovariance //Calculates the covariance between two series of values

statAverageDeviation //Calculates the mean absolute deviations of the values in respect to the arithmetic mean

StatStandardDeviation //Calculates a series standard deviation

StatStandardDeviationP //Calculates a complete series standard deviation

StatError //Returns the number for the last error caused by a statistical function

StatMax //Calculates the maximum value of a series

StatMin //Calculates the minimum value of a series

StatAverage //Calculate the arithmetic, geometric or harmonic mean of a series of values.

StatSum //calculates the sum of a series of values

StatVariance //Calculates the variance of a series

StatVarianceP //Calculates the variance of a complete series


Binary functions

Binary values management functions

BinaryAND //Returns the result of a logical AND (bit by bit) between two values

BinaryNOT //Returns the result of a logical NOT (bit by bit) performed on a value

BinaryOR //Returns the result of a logical OR (bit by bit) between two values

BinaryXOR //Returns the result of a logical exclusive OR (bit by bit) between two values


Mathematical functions

Basic functions

Abs //Calculates the absolute value of a numeric expression (integer or real)

DecimalPart //Returns the decimal part of a number

IntegerPart //Returns the integer part of a number

IsEven //Identifies an even number

IsOdd //Identifies an odd number

Max //Returns the largest of the values passed as parameters

Min //Returns the smallest of the values passed as parameters

Modulo //Returns the remainder after an integer division

Power //Raises a number to a power

Root //Calculates the root of a number

Round //Calculates the rounded value of a numeric value based on the number of decimal places specified.

Trigonometric functions

ArcCos //Calculates the arc cosine of a numeric value (integer or real)

ArcSin //Calculates the arc sine of a numeric value (integer or real)

ArcTan //Calculates the arc tangent of a numeric value (integer or real)

Cos //Calculates an angle's cosine

CoTan //Calculates an angle's cotangent

Exp //Calculates the exponential of a numeric value (inverse of Napierian logarithm)

Ln //Calculates the Napierian logarithm of a numeric value (inverse of the exponential function)

Log //Calculates the logarithm of a numeric value

Sin //Calculates an angle's sine

Tangent //Calculates an angle's tangent

Miscellaneous functions

InitRandom //Initializes the random number generator

Random //Returner

NumToString //Returns a character string corresponding to the number passed as a parameter based on a described format


TRUE functions list

//For flow
Fvalue // return the sum of the values transferred by a flow

//For stock
Svalue // return the value of a stock
Mvalue // return the value of a mirror stock

Options // setup one or more functionalities in a action to be done after the calculation

Aresult // display a string in a "Results" window

//Pseudo-variable
ValueRead // read the value of a pseudo-variable
ValueWrite // store a value in a pseudo-variable

//Retro-calculation
ReStartAt // setup retro-calculationo
ReStartStat // return the stat of the retro-calculation

List of functions added to W-Language For more information, consult the user manual: "Man05-Actions"

SetGlobalProcedure //declare a global procedure

CallGlobalProcedure //call a global procedure

Rand //returns a random number in range 0 to 1 / 32767

Srand //initialize the seed for random numbers for the Rand function

NormalMS //returns a random number according to the normal distribution (Mean, Sigma) NormalMSMM //returns a random number according to the normal distribution (Mean, Sigma, Min, Max) NormalMM //returns a random number according to the normal distribution (Min, Max)

MeanSigma //set Mean and Sigma according to Min and Max

SawtoothN //sawtooth signal generator (negative)

SawtoothP //sawtooth signal generator (positive)

Sign //return sign

Triangle //triangle signal generator

TriangleCos //triangle signal generator with cosinus phase

TriangleS //triangle signal generator with symetry parameter

WithLookUp //specifies a nonlhip between the input x and the output by passing the input through a series of x,y pairs specified as numbers


Abs

Use

//Calculates the absolute value of a numeric expression or a numeric value (integer or real)
// Retrieve the absolute value
AbsRes = Abs(-16.23) // Returns 16.23
AbsRes = Abs(4.51+16.23) // Returns 20.74

Syntax

<Result> = Abs(<Numeric>)

-Parameters detail

<Result> // Integer or real, absolute value sought.
<Numeric> // Numeric expression, integer or real, numeric expression or numeric value to use.

Notes

-Decimal separator
//The decimal separator for real numbers is the one defined in the Windows control panel.

-Precision of real numbers
//If the parameter passed to the function is a real number, the result is always a real number coded on 8 bytes.
//If the parameter passed to the function is a real number coded on 4 bytes, the result will be considered as a real number on 8 bytes, which may result in additional decimal places when displaying the number. For example:

rValue is real on 4 bytes = -1.70

Trace(Abs(rValue)) // displays 1.700000047684

//To avoid this type of problem, use real numbers without specifying their size, or use currency type.


ArcCos

Arcos

Use

//Returns the arc cosine of a numeric value (integer or real).

// Retrieve the arc cosine of 0.5
ArcCosineRes = ArcCos(0.5)
// Returns 60

Syntax

<Result> = ArcCos(<Numeric value>)

-Parameters detail

<Result> // Real, arc cosine (angle in degrees of the cosine) of the specified numeric value, found in the interval [0,180].
<Numeric Value> // Integer or real, numeric value (cosine) to use.
//This value must be found in the interval [-1,1]. Otherwise there will be a W-Language error.


ArcSin

ArSin

Use

//Returns the arc sine of a numeric value (integer or real).

// Retrieve the arc sine of 0.5
ArcSineRes = ArcSin(0.5)
// Returns 30

Syntax

<Result> = ArcSin(<Numeric value>)

-Parameters detail

<Result> // Real, arc sine (angle in degrees of the sine) of the specified numeric value, found in the interval [-90.90].
<Numeric Value> // Integer or real, numeric value (sine) to use.
//This value must be found in the interval [-1,1]. Otherwise there will be a W-Language error.


ArcTan

ArTan

Use

//Returns the arc tangent of a numeric value (integer or real).

// Retrieve the arc tangent of 12
ArcTangentRes = ArcTan(12)
// Returns 85.2363583093

Syntax

<Result> = ArcTan(<Numeric value>)

-Parameters detail

<Result> // Real, arc tangent (angle in degrees of the tangent) of the specified numeric value, found in the interval [-90, 90] excluding end points.
<Numeric Value> // Integer or real, numeric value (tangent) to use.


Aresult

Aresult (TRUE function)

Use

// Display a string in a "Results" window.

-Example 1

//y is the return value of the procedure
y=100 * (50/35.6)
Aresult(0,"y = ", y ," = y value in Action 1")

-Example 2

ch1, ch2 are string
ch1="Hello, we are the "
ch1=", it is "
Aresult(ch1,DateSys(),ch1,Timesys()
)
//Datesys() returns the date, Timesys() return the time

-Example 3

Aresult(2,"Ok")

Syntax

Aresult(<Results window number>,<Text1>,[<Text2>],[<Text3>],... )

-Parameter details

<Results window number> // integer. Number of the target "Results" window.
<Text1> // Character string containing the message to be displayed. This parameter is obligatory.
<Text2> // Character string containing the message to be displayed. This parameter is optionnal.
<Text...> // Character string containing the message to be displayed. This parameter is optionnal.


Fvalue

Fvalue (TRUE function)

Use

//Return the transfer value of a flow of the model, which represents the sum of the values transferred by the actions of the flow.

-Example 1

//y is the return value of the procedure
y = Fvalue("ab")
//y = transfer value of flow ab for current cycle c and current time

-Example 2

//y is the return value of the procedure
//c is the current cycle
//t is the current time unit
c_, t_ are int
c_= 4; t_= 10
IF c_ <= c AND t_ <= t THEN y = Fvalue("ab",c_,t_)
//y = transfer value of the flow ab for cycle c_=4 and time t_= 10

-Example 3

//y is the return value of the procedure
//nbt is the current number of time, cumulated for all cycles
nbt_ is int
nbt_= nbt-10
IF nbt_ > 0 THEN y = Fvalue("ab",False,nbt_)
//y = transfer value of flow ab for number of time nbt - 10

-First Syntax

Fvalue(<Flow name>,[<Cycle>,<Time>] )

-Parameter details
<Flow name> // Character string, the flow name which transfer value must be obtained.
<Cycle> // Optional integer, cycle for which the transfer value must be obtained.
<Time> // Optional integer, time unit for which the transfer value must be obtained.
//If parameters <Cycle> and <Time>, do not correspond to a valid value, the function will return 0.

-Second Syntax

Fvalue(<Flow name>,[<False>,<Number of time>] )

-Parameter detail
<Flow name> // Character string, is the flow name which transfer value must be obtained.
<False> //: Optional boolean, replaces the <Cycle> parameter, and indicates that the parameter <Number of time>, must correspond to the variable nbt, which represent the number of time for all cycles.
<Number of time> // Optional integer, which is equal to the number of time for all cycles.
//If parameters <Number of time>, doesn't correspond to a valid value, the function will return 0.


ZMatAdd

Use example for the MatAdd function

-Adding two matrix of the same dimension

//The following code adds two matrices.
//In this example we'll assume that the matrices have already been created.
//The existence of the two matrices is tested using MatExist.
//The two matrices must have the same dimension (same number of columns verified by MatNbRow, same number of rows verified by MatNbLine).

// Variable declaration
AdditionRes is boolean

// Test that the matrices exist
IF MatExist("Matrix1") AND MatExist("Matrix2")THEN
// Same number of rows?
IF MatNbLine("Matrix1") = MatNbLine("Matrix2") THEN
// Same number of columns?
IF MatNbRow("Matrix1") = MatNbRow("Matrix2") THEN
// Add the two matrices
AdditionRes = MatAdd("Matrix1", "Matrix2", "MatrixResult")
IF AdditionRes = True THEN
Aresult("The addition has been performed")
ELSE
// Display error message
Aresult(ErrorInfo(errMessage))
END
ELSE
Aresult("The matrices don't have the same number of columns")
END
ELSE
Aresult("The matrices don't have the same number of rows")
END
ELSE
Aresult("The matrices don't exist")
END


ZMatCopy

Use example for the MatCopy function

-Matrix copy

//The following code copies a matrix.
//We assume that the matrix to copy has already been created.
//The existence of the matrix is tested using MatExist.

// Variable declaration
CopyRes is boolean

// Test if the matrix exists
IF MatExist(MatrixName) = TrueTHEN
// Copy matrix
CopyRes = MatCopy(MatrixName, "MyMatrixCopy")
IF CopyRes = True THEN
Aresult("The matrix has been copied")
ELSE
// Display error message
Aresult(ErrorInfo(errMessage))
END
ELSE
Aresult("The matrix doesn't exist")
END


ZMatCreate

Use example for the MatCreate function

-Creating a matrix

//The following code creates a matrix.
//The matrix existence is tested using MatExist before the matrix is created.

// Variable declaration
ExistRes is boolean
OverwriteRes is boolean
CreationRes is boolean

// Test if the matrix exists
ExistRes = MatExist(MatrixName)

// The matrix exists
IF ExistRes = True THEN
// Do you want to overwrite the matrix?
OverwriteRes = YesNo("This matrix already exists. Do you want to overwrite it?")
END

// The matrix doesn't exist or the existing matrix should be overwritten
IF ExistRes = False OR OverwriteRes= True THEN
// Create matrix
CreationRes = MatCreate(MatrixName)
END

// Error?
IF CreationRes = False
// Display error message
Aresult(ErrorInfo(errMessage))
ELSE
Aresult("The matrix has been created")
END


ZMatDelete

Use example for the MatDelete function

-Deleting a matrix

//The following code deletes a matrix.
//We assume that the matrix to delete has already been created.

// Delete the matrix
MatDelete(MatrixName)
Aresult("The deletion has been performed")


ZMatDeterminant

Use example for the MatDeterminant function

-Calculate a matrix determinant

//The following code calculates a matrix determinant.
//We assume that the matrix has already been created.
//The existence of the matrix is tested using MatExist.
//The number of columns in the matrix must be equal to the number of rows.

// Variable declaration
DeterminantlRes is real

// Test if the matrix exists
IF MatExist(MatrixName) = True THEN
// Nbr of matrix columns = Nbr of matrix rows?
IF MatNbRow(MatrixName) = MatNbLine(MatrixName) THEN
// Calculate determinant
DeterminantRes = MatDéterminant(MatrixName)
IF DeterminantRes <> 0 THEN
Aresult("The determinant value is: "+DeterminantRes)
ELSE
// Error?
IF Aresult(MatError(MatrixName)) = 0 THEN
Aresult("The determinant is null")
ELSE
// Display error message
Aresult(ErrorInfo(errMessage))
END
END
ELSE
Aresult("The number of columns is not equal to the number of rows")
END
ELSE
Aresult("The matrix doesn't exist")
END


ZMatError

Use example for the MatError function

-Display the error message

//The following code displays the last error that occurred on a matrix.

// Variable declaration
ErrorRes is int

// Error on matrix?
ErrorRes = MatError(MatrixName)

// Display error message
IF ErrorRes <> 0 THEN
Aresult(ErrorInfo(errMessage))
END


ZMatExist

Use example for the MatExiste function

-Tests if a matrix exists

//The following code tests if a matrix exists.

// Variable declaration
ExistRes is boolean

// Test if the matrix exists
ExistRes = MatExist(MatrixName)
IF ExistRes = True THEN
Aresult("The matrix exists")
ELSE
Aresult(ErrorInfo(errMessage))
END


ZMatFill2

Use example for the MatFill2 function

-Filling out a matrix

//The following code fills a matrix.
//This matrix is filled from row 1 to 5 and from column 1 to 3 by the value 7.
//The existence of the matrix is tested using MatExist.
//The matrix is created using MatCreate.

// Variable declaration
ExistRes is boolean
OverwriteRes is boolean
CreationRes is boolean
FillRes is boolean

// Test if the matrix exists
ExistRes = MatExist(MatrixName)

// The matrix exists
IF ExistRes = True THEN
// Do you want to overwrite the matrix?
OverwriteRes = YesNo("This matrix already exists. Do you want to overwrite it?")
END

// The matrix doesn't exist or the existing matrix should be overwritten
IF ExistRes = False OR OverwriteRes= True THEN
// Create matrix
CreationRes = MatCreate(MatrixName)
END

// Error?
IF CreationRes = False
// Display error message
Aresult(ErrorInfo(errMessage))
ELSE
// Fill the matrix.
// Filling matrix from row 1 to 5 and from column 1 to 3 with the value 7.
FillRes = MatFill2(MatrixName, 7, 5, 3)
// Error?
IF FillRes = True
Aresult("The matrix has been filled")
ELSE
// Display error message
Aresult(ErrorInfo(errMessage))
END


ZMatFloatAdd

Use example for the MatFloatAdd function

-Add a value to all the elements of a matrix

//The following code adds the value 5 to all the elements of a matrix.
//We assume that the matrix has already been created.
//The existence of the matrix is tested using MatExist.

// Variable declaration
AddRealRes is boolean

// Tests if the matrix exists
IF MatExist(MatrixName) THEN
// Add the value 5 to all the matrix elements
MatFloatAdd(MatrixName, 5)
// Error?
IF Aresult(MatError(MatrixName)) = 0 THEN
Aresult("The addition has been performed")
ELSE
// Display error message
Aresult(ErrorInfo(errMessage))
END
ELSE
Aresult("The matrix doesn't exist")
END


ZMatFloatMultiply

Use example for the MatFloatMultiply function

-Multiply the elements of a matrix by a value

//The following code multiplies all the elements of a matrix by the value 5.
//We assume that the matrix has already been created.
//The existence of the matrix is tested using MatExist.

// Test if the matrix exists
IF MatExist(MatrixName) THEN
// Multiply by 5 all the matrix elements
MatFloatMultiply(MatrixName, 5)
// Error?
IF Aresult(MatError(MatrixName)) = 0 THEN
Aresult("The multiplication has been performed")
ELSE
// Display error message
Aresult(ErrorInfo(errMessage))
END
ELSE
Aresult("The matrix doesn't exist")
END


ZMatInvert

Use example for the MatInverse function

-Inverting a matrix

//The following code inverts a matrix.
//We assume that the matrix has already been created.
//The existence of the matrix is tested using MatExist.
//The number of columns in the matrix must be equal to the number of rows.
//This determinant can't be null.

// Variable declaration
InvertRes is boolean

// Test if the matrix exists
IF MatExist(MatrixName) = True THEN
// Nbr of matrix columns = Nbr of matrix rows?
IF MatNbRow(MatrixName) = MatNbLine(MatrixName) THEN
// Determinant not null?
IF MatDéterminant(MatrixName) <> 0 THEN
// Invert matrix
InvertRes = MatInvert(MatrixName, "MyInvertedMatrix")
// Error?
IF InvertRes = True THEN
Aresult("The inversion has been performed")
ELSE
// Display error message
Aresult(ErrorInfo(errMessage))
END
ELSE
Aresult("The determinant is null")
END
ELSE
Aresult("The number of columns isn't equal to the number of rows")
END
ELSE
Aresult("The matrix doesn't exist")
END


ZMatMultiply

Use example for the MatMultiply function

-Multiplying two matrices

//The following code multiplies two matrices.
//We assume that the matrices have already been created.
//The existence of the two matrices is tested using MatExist.
//The number of columns in the first matrix must be equal to the number of rows in the second matrix.

// Variable declaration
MultiplyRes is boolean

// Test that the matrices exist
IF MatExist("Matrix1") AND MatExist("Matrix2")THEN
// Number of columns of first matrix = Number of rows of second matrix?
IF MatNbRow("Matrix1") = MatNbLine("Matrix2") THEN
// Multiply the two matrices
MultiplyRes = MatMultiply("Matrix1", "Matrix2", "MatrixResult")
IF MultiplyRes = True THEN
Aresult("The multiplication has been performed")
ELSE
// Display error message
Aresult(ErrorInfo(errMessage))
END
ELSE
Aresult("The number of columns isn't equal to the number of rows")
END
ELSE
Aresult("The matrices don't exist")
END


ZMatNbLine

Use example for the MatnbLine function

-Number of rows in a matrix

//The following code is used to find out the number of rows in a matrix.
//The matrix name is entered by the end user in an edit control (MatrixName).

// Variable declaration
NbRowRes is int

// Number of rows?
NbRowRes = MatNbLine("MyMatrix")
// Error?
IF Aresult(MatError(MatrixName)) = 0THEN
Aresult("The matrix contains: "+NbRowRes+" row(s)")
ELSE
// Display error message
Aresult(ErrorInfo(errMessage))
END


ZMatNbRow

Use example for the MatNbRow function

-Number of columns of a matrix

//The following code is used to find out the number of columns in a matrix.

// Variable declaration
NbColumnRes is int

// Number of columns?
NbColumnRes = MatNbRow(MatrixName)
// Error?
IF Aresult(MatError(MatrixName)) = 0 THEN
Aresult("The matrix contains: "+NbColumnRes+" column(s)")
ELSE
// Display an error message
Aresult(ErrorInfo(errMessage))
END


ZMatRead

Use example for the MatRead function

-Reads an element into a matrix.

//The following code reads an element value from a matrix.

// Variable declaration
ReadRes is real

// read element
ReadRes = MatRead(MatrixName, ElementRow, ElementColumn)
// Error?
IF Aresult(MatError(MatrixName)) = 0 THEN
Aresult("the element value (row "+ElementRow+...
"column "+ElementColumn+") is: "+ReadRes)
ELSE
// Display error message
Aresult(ErrorInfo(errMessage))
END


ZMatReadColumn

Use example for the MatReadColumn function

-Reading a column's elements from a matrix

//The following code reads the value of a column's elements from a matrix.

// Variable declaration
ReadColumnRes is string

// Read the column's elements. Each element will contain 10
// characters, including 2 digits after the decimal point, in a real format.
ReadColumnRes = MatReadColumn(MatrixName, ElementColumn, "10.2f")
// Error?
IF Aresult(MatError(MatrixName)) = 0 HEN
Aresult("the column's elements"+ElementColumn+" are: "+ReadColumnRes)
ELSE
// Display error message
Aresult(ErrorInfo(errMessage))
END


ZMatReadLine

Use example for the MatReadLine function

-Reading a row's elements from a matrix

//The following code reads the value of a row's elements from a matrix.

// Variable declaration
ReadRowRes is string

// Read the row's elements. Each element will contain 10
// characters, including 2 digits after the decimal point, in a real format.
ReadRowRes = MatReadLine(MatrixName, ElementRow, "10.2f")
// Error?
IF Aresult(MatError(MatrixName)) = 0 THEN
Aresult("the row's elements"+ElementRow+" are: "+ReadRowRes)
ELSE
// Display error message
Aresult(ErrorInfo(errMessage))
END


ZMatStack

Use example for the MatStack function

-Compressing a matrix

//The following code compresses a matrix.

//We assume that the matrix to compress has already been created.

// Compress the matrix
MatStack(MatrixName)
// Error?
IF Aresult(MatError(MatrixName))= 0 THEN
Aresult("The compression was successful")
ELSE
// Display error message
Aresult(ErrorInfo(errMessage))
END


ZMatTranspose

Use example for the MatTranspose function

-Calculation of the transposed of a matrix

//The following code makes it possible to calculate the transposed of a matrix.
//We assumes that the matrix has already been created.
//The existence of the matrix is tested using MatExist.

//Variable declaration
ResTranspose is boolean

//Test the existence of the matrix

IF MatExist(MatrixName) = True THEN
// Calcul of the transposed of the matrix
ResTranspose = MatTranspose(MatrixName, "MyTransposedMatrix")
// Error ?
IF ResTranspose = True THEN
Aresult("The calculation of the transposed were carried out")
ELSE
// Show an error message
Aresult(ErrorInfo(errMessage))
END
ELSE
Aresult("The matrix does not exist")
END


ZMatWrite

Use example for the MatWrite function

-Writing in a matrix

//The following code writes into a matrix.
//The element (row 2, column 3) receives the value 7.
//The existence of the matrix is tested using MatExist.
//The matrix is created using MatCreate.

// Variable declaration
ExistRes is boolean
OverwriteRes is boolean
CreationRes is boolean
WriteRes is boolean

// Test if the matrix exists
ExistRes = MatExist(MatrixName)

// The matrix exists
IF ExistRes = True THEN
// Do you want to overwrite the matrix?
OverwriteRes = YesNo("This matrix already exists. Do you want to overwrite it?")
END

// The matrix doesn't exist or the existing matrix should be overwritten
IF ExistRes = False OR OverwriteRes= True THEN
// Create matrix
CreationRes = MatCreate(MatrixName)
END

// Error?
IF CreationRes = False
Aresult(ErrorInfo(errMessage))
ELSE
// Write into the matrix
// Reminder : The element (row 2, column3) receives the value 7
WriteRes = MatWrite(MatrixName, 7, 2, 3)
IF WriteRes = True
Aresult("The write operation has been performed")
ELSE
// Display error message
Aresult(ErrorInfo(errMessage))
END
END


SQLLock

Nouvelle page
Saisissez ici le texte de la page


SQLModify

Nouvelle page
Saisissez ici le texte de la page


SQLNext

Nouvelle page
Saisissez ici le texte de la page


SQLPrevious

Nouvelle page
Saisissez ici le texte de la page


SQLReqExists

Nouvelle page
Saisissez ici le texte de la page


SQLSeek

Nouvelle page
Saisissez ici le texte de la page


SQLTable

Nouvelle page
Saisissez ici le texte de la page


Asc

Use

//Calculates the ASCII code of the specified character. The ASCII code used corresponds to the ANSI norm used by Windows.

ASCIICode = Asc("A") // Returns 65
ASCIICode = Asc("Barbier") // Returns 66

Syntax

<Result> = Asc(<Character string>)

-Parameters detail

<Result> // Integer, ASCII code sought (found between 0 and 255).
<Character string> // Character or character string, characters which ASCII code must be calculated.
//If this parameter is :
//an empty string, <Result> will be equal to 0.
//a character string, <Result> will be equal to the ASCII code of the first character.

Notes

-String extraction
//The string extraction (using the [[ and ]] operators) can be used to convert a character in any position in the string.
//For example :
Asc(Ch[[N]]) // returns the ASCII value of the Nth character of the string "Ch".


BinaryAND

Use

//Returns the result of a logical AND (bit by bit) between two values.

// Retrieve the result of a logical AND
BinaryANDRes = BinaryAND(6, 6) // Returns 6
BinaryANDRes = BinaryAND(6, 2) // Returns 2

Syntax

<Result> = BinaryAND(<Value 1>, <Value 2>)

-Parameters detail

<Result> // Integer, result of the logical AND.
<Value 1> // Integer, first value to test.
<Value 2> // Integer , second value to test.

Notes

-Bit by bit calculation
//BinaryAND performs the calculation bit by bit between <Value 1> and <Value 2> according to the following table :

0 0 1
0 0 0
1 0 1


BinaryNOT

Use

//Returns the result of a logical NOT (bit by bit) performed on a value.

-Reminder :
//The logical NOT operation is equivalent to the "Complement to one" operation The logical negation applies to ALL the bits of the value.

// Retrieve the result of the logical NOT
BinaryNOTRes = BinaryNOT(6) // Returns -7
BinaryNOTRes = BinaryNOT(2) // Returns -3

Syntax

<Result> = BinaryNOT(<Value>)

-Parameters detail

<Result> // Integer, result of the logical NOT.
<Value 1> // Integer, value to test.

Notes

-Bit by bit calculation
//BinaryNOT performs the calculation bit by bit on <Value> according to the following table :

Valuet 0 1
Result 1 0


BinaryOR

Use

//Returns the result of a logical OR (bit by bit) between two values.

// Retrieve the result of a logical OR
BinaryORRes = BinaryOR(6, 6) // Returns 6
BinaryORRes = BinaryOR(6, 2) // Returns 6

Syntax

<Result> = BinaryOR(<Value 1>, <Value 2>)

-Parameters detail

<Result> // Integer, result of the logical OR.
<Value 1> // Integer, first value to test.
<Value 2> // Integer, second value to test.

Notes

-Bit by bit calculation
//BinaryOR performs the calculation bit by bit between <Value 1> and <Value 2> according to the following table :

0 0 1
0 0 1
1 1 1


BinaryXOR

Use

//Returns the result of a logical exclusive OR (bit by bit) between two values.

// Retrieve the result of a logical exclusive OR
BinaryXORRes = BinaryXOR(6, 6) // Returns 0
BinaryXORRes = BinaryXOR(6, 2) // Returns 4

Syntax

<Result> = BinaryXOR(<Value 1>, <Value 2>)

-Parameters detail

<Result> // Integer, result of the logical exclusive OR.
<Value 1> // Integer, first value to test.
<Value 2> // Integer, second value to test.

Notes

-Bit by bit calculation
//BinaryXOR performs the calculation bit by bit between <Value 1> and <Value 2> according to the following table :

0 0 1
0 0 1
1 1 0


Charact

Use

//Returns the character corresponding to the specified ASCII code. The ASCII code used corresponds to the ANSI norm used by Windows.

ASCIIChar = Charact(49) // Returns "1"
ASCIIChar = Charact(87) // Returns "W"

Syntax

<Result> = Charact(<ASCII code>)

-Parameters detail

<Result> // Character string, character corresponding to the specified ASCII code.
<ASCII code> // Integer, value to convert (found between 0 and 255).
// If this value is not valid, a W-Language error is generated.

Notes

-Avoid using Charact
//The following predefined constants can be used instead of the Charact function :
CR // is equal to Charact(13) + Charact(10) // Carriage return
TAB // is equal to Charact(9) // Tabulation
ESC // is equal to Charact(27) // Escape
SPC // is equal to Charact(160), (indivisible space)


Complete

Use

//Returns a given character string in a specific size. This string may be truncated or completed by spaces (or by another character) to reach the required size.

Complète("Alan", 8) // Returns "Alan "
Complète("Alan", 8, "A") // Returns "AlanAAAA"
Complète("Alexander", 4) // Returns "Alex"

Syntax

<Result> = Complète(<string to Complète>, <Size> [, <Character>])

-Parameters detail

<Result> // Character string, character string of the specific size, completed or truncated.
//If <String to complete> has a smaller size than <size>, the string is completed on the right by spaces or by specific characters if the <Character> parameter is specified.
//If <String to complete> has a greater size than <Size>, the string is truncated on the right (equivalent to the Left function).

<string to Complète> // Character string, initial character string to complete or truncate.
//This character string is not truncated:

<Size> // Integer, new size of the character string (greater or equal to 0).

<Character> // Character, character used to complete the string.
//By default, this character is a blank space.

Notes

-Miscellaneous
//If the <Size> parameter is smaller than 0, a W-Language error occurs.
//By convention, the first index of a character string is character 1.


Confirm

Use

//Displays a message in a standard dialog box offering the answers "Yes", "No", or "Cancel" and returns the user's answer.
//To close the window, the user must validate one of the buttons.

Result is an integer
Result = Confirm("Modification not saved","Do you want to save it?")
IF Result = Yes THEN
SaveForm() // Save process
ELSE
IF Result = cancel THEN
ReturnToCapture() // Cancel choice
ELSE // Result = No
Close() // Exit the window
END
END

Syntax

<Result> = Confirm([<Selected button>], <Text> [, <Line 2> ... [, <Line n>]])

-Parameters detail

<Result> // Integer type constant, identifies the button selected by the user:
No //0, the user has chosen the button [NO]
Yes //1, the user has chosen the button [YES]
cancel //2, the user has chosen the button [CANCEL]

<Selected button> // Optional integer type constant, button selected by default in the dialog box :
No //0, button [NO] selected by default
Yes //(by default) 1, button [YES] selected by default
cancel //2, button [CANCEL] selected by default

<Text> //: Character string, text to print

<Line 2> ... <Line n> // Optional character strings, text displayed on the following lines.

Notes

-Characteristics of the dialog box
//The title of the dialog box is the title of the current window.
//The message is aligned to the left.
//The buttons' labels are based on the Windows execution language.
//The maximum number of characters displayed is limited to 4096.
//If a larger string is passed as a parameter, it will be truncated.
//The icon displayed cannot be modified (exclamation mark).

-Line break in the dialog box
//The CR (Carriage Return) pre-defined string can be used to force a break to the next line.
//For example :
Confirm("The form XXX has been modified." + CR +...
"Do you want to save the changes?")
//is equivalent to:
Confirm("The form XXX has been modified.",...
"Do you want to save the changes?")


Cos

Use

//Calculates an angle's cosine.

// Calculate the cosine for 60
CosineRes = Cos(60)
// Returns 0.5

Syntax

<Result> = Cos(<Angle>)

-Parameters detail

<Result> // Real, Cosine of the specified angle.

<Angle> // Integer or real, angle (in degrees) to manipulate.
// This parameter can have any value : the cosine calculation is performed "modulo 360".


Cotan

Use

//Calculates an angle's cotangent.

// Calculate the cotangent of 20
CoTangentRes = CoTan(20)
// Returns 2.74747741945

Syntax

<Result> = CoTan(<Angle>)

-Parameters detail

<Result> // Real, cotangent of the specified angle.

<Angle> // Integer or real, angle (in degrees) to manipulate.
// If this parameter is set to 0°, 180° or -180°, a W-Language error occurs.


DataType

Use

//Identifies the type of a W-Language variable.

IF DataType(Var1)<>12 THEN
Aresult("Var1 is not a character string type")
ELSE
Aresult("Var1 is a character string type")
END

Syntax

<Result> = DataType(<Variable name>)

-Parameters detail

<Result> // Integer, identifies the variable type.
1 //Integer
2 //Unsigned integer
3 //Long integer
6 //Simple real
7 //Turbo real
8 //Double real
12 //Characters and character strings (string, fixed string, ASCIIZ string, Pascal string)
17 //Short integer and boolean
18 //Currency

<Variable name> // Character string, name of the W-Language variable.


DecimalPart

Use

//Returns the decimal part of a number.

// Decimal part of 16.487
DecimalPartRes = DecimalPart(16.487)
// Returns 0.487

Syntax

<Result> = DecimalPart(<Number>)

-Parameters detail

<Result> // Real, decimal part sought.
<Number> //Real, number to use.


Dimension

Use

//Returns the size of a variable (string, numeric, array, and so on) or resizes a dynamic array.

// Resize a dynamic array
MyTab is dynamic array of 5 by 3 int
...
// Resize the array
Dimension(MyTab, 8, 6)

Syntax

-Retrieving the size of a variable
<Result> = Dimension(<Variable name>)

-Parameter detail

<Result> // Integer, size sought

-Examples

-Pascal string
//Number of useful character in the string
Ch is Pascal string on 10
Aresult(Dimension(Ch)) // 10

-ASCIIZ string
//Number of useful characters in the string
Ch is ASCIIZ string on 10
Aresult(Dimension(Ch)) // 9 because of the binary 0 at the end

-Composite variable
//Sum of the size in bytes of each component

-Array
//Total number of elements of the array
//Tab1 is array of 3 string
Aresult(Dimension(Tab1)) // Display 3
Tab2 is array of 5 by 3 int
Aresult(Dimension(Tab1)) // Display 15 = 5 * 3

-Others
//Size in bytes
<Variable name> // Character string

<Name of the variable> // (variable of any type).

-Resizing a dynamic array

Dimension(<array name>, <Dimension 1>, ..., <Dimension N>)

-Parameters detail
<array name> // Character string, variable corresponding to the dynamic array.
<Dimension 1> ... <Dimension N> // Integer, new dimensions of the array.
// Caution: the number of dimensions of the array can't be modified, nor the type of the elements.
// An 2 dimensional array remains a two dimensional array.


EndTrace

Use

//Closes the Trace window if this window has been opened.

-Note :
//The trace window is automatically closed when the project closes.

// Closing the trace window
EndTrace()

Syntax

EndTrace()


Error

Use

//Displays a custom error message in a system error window.

//To close the window, the user must validate the OK button.

Error("This customer does not exist.","You must create it before")

Syntax

Error(<Text> [, <Line 2> ... [, <Line n>]])

-Parameters detail

<Text> // Character string, text to print
<Line 2> ... <Line n> // Optional character strings, text displayed on the following lines.

Notes

-Characteristics of the dialog box
//The title of the dialog box is the title of the current window.
//The message is aligned to the left.
//The button's label is based on the Windows execution language.
//The maximum number of characters displayed is limited to 4096.
//If a larger string is passed as a parameter, it will be truncated.
//The icon displayed cannot be modified (white cross).

-Line break in the dialog box
//The CR (Carriage Return) pre-defined string can be used to force a break to the next line.
//For example :
Error("The form XXX has been modified." + CR +...
"Do you want to save the changes?")
//is equivalent to:
Error("The form XXX has been modified.",...
"Do you want to save the changes?")


ErrorInfo

Use

//Retrieves information about the last error on a WinDev function.

-Caution :
// The ErrorInfo function must be used right after the call to the function that failed.
// This is because the call to another function can reinitialize and modify the status code of ErrorInfo.

// Open the presentation file
nFileId is int = fOpen(FileName, foRead)
// Check the file opening
IF nFileId = -1 THEN
Aresult("Can't open file: " + FileName, ErrorInfo())
RETURN False
END

Syntax

<Result> = ErrorInfo([<Information type>])

-Parameters detail

<Result> // Character string or integer, information requested.
// An empty string if no error occurred or if the information requested is not available.

<Type of information> // Constant, information to return.

errCode //Error code
errFullDetails //All the pieces of information about the error (error line, current process, etc.)
//Note : Returns the same pieces of information as the ones retrieved when clicking the "Copy" button in the W-Language error window.
errMessage //(default value), Full error message.
errSummary //Error summary
errInfo //Additional information
errDebugInfo //Information specific to debugging the problem that occurred.
//This information should be displayed and communicated only on the expressed demand from PC SOFT.
//In the case when executing a query using OLE DB, this option enables you to recover the code of the SQL query actually performed on the database.
errDuring //Name of the W-Language function that triggered the error
errElément //Name of the object associated with the current process at the time of the error.
errProcess //Name of the current process at the time of the error
errLine //Line number of the error
errFile //Logical name of the file associated with the error
errRecNum //Record number associated with the error
errItem //Name of the item associated with the error
errWDD //Full name of the WDD associated with the error
errFIC //Full name of the data file (FIC) associated with the error
errNDX //Full name of the index file (" .NDX") associated with the error
errMMO //Full name of the memo file (".MMO") associated with the error
errLink //Name of the link associated with the error
errSystemCode //Number of the system error (if it exists)
errSystemMessage //Message of the system error (if it exists)


Exp

Use

//Calculates the exponential of a numeric value (inverse of Napierian logarithm).

// Calculate the exponential for 5
ExponentialRes = Exp(5)
// Returns 148.413159103

Syntax

<Result> = Exp(<Numeric value>)

-Parameters detail

<Result> // Real, exponential sought.

<Number> // Integer or real, numeric value to use.


ExtractString

ExtracString

Use

//Extracts a sub-string from a character string based on a given string separator.

-Some use examples:
//extracting data read in an external file,
//extract information returned by HListFile or HListKey,
//extract data from a list containing different data on the same line.

Ch is string = "ABC" + TAB+ "" + TAB+ "" + TAB+ "DEF"
ExtractString(Ch, 1) // Returns "ABC"
ExtractString(Ch, 2) // Returns ""
ExtractString(Ch, 3) // Returns ""
ExtractString(Ch, 4) // Returns "DEF"
ExtractString(Ch, 5) // Returns EOT

Syntax

<Result> = ExtractString(<Initial string>, <Rank>[, <Separator> [<Direction>]])

-Parameters detail

<Result> // Character string, corresponds to :
//The sub-string found between the separator of rank <Rank> -1 and the separator of rank <rank> if <Direction> is not defined or is equal to FromBeginning.
//The sub-string found between the separator of rank <Rank> -1 and the separator of rank <rank> from the end of the string if <Direction> is set to FromEnd.
//The <Initial string> in its entirety if the <Initial string> doesn't contain any separator and if <Rank> is equal to 1.
//The EOT constant if <Rank> is larger than the number of separators contained in the string.

<Initial string> // Character string, character string (maximum size: 2 GB) containing the string to extract.

<Rank> // Integer, order number of the separator.
// For example, if the separator is TAB and if <Rank> is equal to 2, the extracted string will be found between the first and the second TAB.

<Separators> // Character string, string used to mark the sub-strings.
// If this parameter is not specified, the default mark is TAB.
// This string is not included in the result.

<Direction> // Optional constant, direction in which the search is performed :
FromBeginning //(by default), search performed from the first character of the string to the last one.
FromEnd //Search performed from the last character of the string to the first one.


FinCurrentVal

Example

Use

//Returns the current value of an investment

-Reminder :
//The current value corresponds to the sum today of a set of future payments.
//For example, when you get a loan, the loan amount represents the current value for the lender.

//Current value of an investment. The pay off value is $5,000.
// This investment must bring in $50,000 per year for 10 years.
// The interest rate is 8%.
CurrentValueRes = FinCurrentVal(-5000,50000, 10, 8)

Syntax

<Result> = FinCurrentVal([<Pay off value> [, <Future value> [, <Number of periods> [,<Rate> [,<Start>]]]]])

-Parameters detail

<Result> // Real or currency, current value of the investment.

<Payment amount> // Optional real or currency, payment value for each period (0 by default).
//This payment is identical for the entire time. This value must be negative.

<Future value> // Optional real or currency, future value (capitalized value).
//This is the amount after the last payment (0 by default).

<Number of periods> // Optional integer, total number of periods in the investment (1 by default).

<Rate> // Optional real, investment interest rate expressed as a percentage (1 by default).
//For example, for a 5% investment rate, this parameter is equal to 5. This rate can't be null.

<Start> // Optional boolean,
True //if the payments must be performed at the beginning of the period,
False //if the payments must be performed at the end of the period.

Notes

-Time unit
//Calculations can be performed based on months or years.
<Rate> and <Period> // parameters must simply use the same time unit.

//Therefore, to get the current value of a 4-year loan, paid off monthly,
//with a 10% annual interest rate, you can use units expressed in months :
<Period> = 4*12,
<Rate> = 10% / 12

-Error management
//Caution : The FinCurrentVal function doesn't return an error code.
//To find out if this function has generated any error, use the FinError function.
//The text of the error message can be known by using the ErrorInfo function with the errMessage constant.


FinDecreasingRedemption

Example

Use

//Calculates the value of the amortization of a good over a specific period of time using the decreasing fixed rate amortization formula.

// Amortization value of a good bought for $25,000 whose residual value
// will be $15,000 after 6 years.
AmortizationRes = FinDecreasingRedemption(25000, 15000, 6)

Syntax

<Result> = FinDecreasingRedemption(<Acquisition cost>, <Residual value>, <Duration> [,<Period> [,<Number of months (year 1)>]])

-Parameters detail

<Result> // Real or currency, amortization value for the given <Period> or 0 if the amortization is null.

<Acquisition cost> // Real or currency, acquisition cost of the good. This cost cannot be null.

<Residual value> // Real or currency, residual value of the good after the amortization.

<Duration> // Real, number of periods during which the good is amortize. This duration cannot be null.

<Period> // Optional integer, period over which the amortization must be calculated (1 by default).

<Number of months (year 1)> // Optional integer, number of months in the first amortization year (1 by default).
//This number may be found between 0 and 12.

Notes

-Fixed rate amortization
//The fixed rate amortization method consists in calculating the amortization of a good using a fixed rate over the amortization period.
//This rate is applied to the current value of the good over each period.

//The current value of the good is :
<Acquisition cost> - <Total amortization>
//where <Total amortization> represents the total amount of the amortization over the previous periods.

//This rate is calculated based on the residual value, the acquisition cost of the good and the amortization.

//The calculation of the amortization value for the first year as well as for the last year is different:
//for the first year, only the number of amortized months is taken into account (<Number of month (Year 1)>);
//for the last year, the number of months amortized corresponds to:
12 - <Number of months (year 1)>.

//Note : If the number of months for the first year is equal to 1, this year is included in the duration.

-Error management
//Caution : The FinDecreasingRedemption function doesn't return an error code.
//To find out if this function has generated any error, use the FinError function.
//The text of the error message can be known by using the ErrorInfo function with the errMessage constant.


FinError

Example

Use

//Returns the number for the last error caused by a Finxxx function (financial function).

// Identify the error type
ErrorRes = FinError()

Syntax

<Result> = FinError()

-Parameter detail

<Result> // Integer, returns the number for the last error caused by a financial function:

-Number, Error type, Affected functions
0 //No error, All the functions
1 //This duration cannot be null, FinDecreasingRedemption, FinLinearRedemption
2 //The matrix is empty, FinNetCurrentVal
3 //This cost cannot be null, FinCurrentVal, FinFuturVal
4 //The period can't be larger than the duration, FinPeriodInterest
5 //Invalid amortization type, FinRedemption
6 //The pay-off amount is null, FinPaymentNb
7 //Data inconsistency, FinInterestRate, FinPaymentNb
8 //The acquisition cost can't be null, FinDecreasingRedemption, FinLinearRedemption
9 //The matrix doesn't exist, FinNetCurrentVal
10 //Maximum values exceeded, All the functions
11 //Impossible calculation (division by zero), FinRedemption, FinPeriodInterest, FinCurrentVal, FinNetCurrentVal, FinRepayVal
12 //Infinite number of payments, FinPaymentNb
13 //The rate wasn't found, FinInterestRate
14 //The period is higher than the duration, FinDecreasingRedemption
15 //Number of months in the first year not found between 0 and 12, FinDecreasingRedemption

Notes

-Text of the error.
//The text of the error message can be known by using the ErrorInfo function with the errMessage constant.


FinFuturVal

Example

Use

//Returns the current value of an investment. The payments are regular and fixed. The interest rate is fixed.

//Future value of an investment. The initial capital is $100,000.
// $3,000 are paid each month for 2 years. The interest rate is 8%.
FutureValRes = FinFuturVal(-100000, -3000, 24, 8)

Syntax

<Result> = FinFuturVal([<Initial capital> [,<Regular payment> [, <Number of periods> [,<Rate> [,<Start>]]]]])

-Parameters detail

<Result> // Real or currency, future value of the investment.

<Initial capital> // Optional real or currency, initial capital (0 by default).

<Regular payment> // Optional real or currency, regular payment (0 by default).
//This value is fixed for the entire operation duration. As a rule, this amount includes the capital and interests.

<Number of periods> // Optional integer, total number of periods for the operation (1 by default).

<Rate> // Optional real, investment interest rate expressed as a percentage (1 by default).
//For example, for a 5% investment rate, this parameter is equal to 5. This rate can't be null.

<Start> // Optional boolean
True //if the payments must be performed at the beginning of the period,
False //if the payments must be performed at the end of the period.

Notes

-Time unit
//Calculations can be performed based on months or years.
<Rate> and <Period> // parameters must simply use the same time unit.

//Therefore, for monthly payments of a 5-year loan with a 8% annual interest rate, use:
<Rate> = 8% / 12,
<Number of periods> = 5*12

//If, for the same loan, your payments are yearly, use:
<Rate> = 8%,
<Number of periods> = 5

//For all the parameters, the disbursements are represented by a negative number while the collections are represented by a positive number.

-Error management
//Caution : The FinFuturVal function doesn't return an error code.
//To find out if this function has generated any error, use the FinError function.
//The text of the error message can be known by using the ErrorInfo function with the errMessage constant.


FinInterestRate

Example

Use

//Calculates the interest rate for a loan over a given length of time with fixed payments .

-Note :
//The interest rate is assumed to be fixed over the period.

// Interest rate for a $25,000 loan. Six payments
// of $5,000 are required for repaying the loan.
InterestRateRes = FinInterestRate(6, -5000, 25000)

Syntax

<Result> = FinInterestRate(<Number of payments required> [, <Payment amount> [,<Capital>]])

-Parameters detail

<Result> // Real or currency, interest rate sought.

<Number of payments required> // Real or currency, total number of payments to perform.

<Payment amount> // Optional real, amount of one payment (0 by default).
//This value must be negative.

<Capital> // Optional real or currency, loan amount (1 by default).

Notes

-Error management
//Caution : The FinInterestRate function doesn't return an error code.
//To find out if this function has generated any error, use the FinError function.
//The text of the error message can be known by using the ErrorInfo function with the errMessage constant.


FinLinearRedemption

Example

Use

//Calculates the value of a linear amortization of a good over a given period of time.

// Amortization value of a good bought for $25,000
// whose residual value will be $15,000 after 6 years.
AmortizationRes = FinLinearRedemption(25000, 15000, 6)

Syntax

<Result> = FinLinearRedemption(<Acquisition cost>, <Residual value>, <Duration>)

-Parameters detail

<Result> // Real or currency, value of the amortization or 0 is the amortization is null.

<Acquisition cost> // Real or currency, acquisition cost of the good. This cost cannot be null.

<Residual value> // Real or currency, residual value of the good after the amortization.

<Duration> // Real, number of periods during which the good is amortize. This duration cannot be null.

Notes

-Linear amortization
//In a linear amortization, the value of the amortization is the same for each amortizing period for the good.

-Error management
//Caution : The FinLinearRedemption function doesn't return an error code.
//To find out if this function has generated any error, use the FinError function.
//The text of the error message can be known by using the ErrorInfo function with the errMessage constant.


FinNetCurrentVal

Example

Use

//Returns the current net value for an investment. This investment is based on variable financial flows.

-Reminder :
//The current net value corresponds to the value as of today's date of a series of future disbursements (negative values) and collections (positive values).

-Note :
//From a financial point of view, an investment will be deemed profitable if its NCV (Net Current Value) is positive.

//Current net value of an investment. The interest rate is 8%.
NetCurrentValRes = FinNetCurrentVal(8, "Matrix")

Syntax

<Result> = FinNetCurrentVal(<Rate>, <Matrix name> [,<Row/column number> [, <Row/Column>]])

-Parameters detail

<Result> // Real or currency, current net value of the investment.

<Rate> // Real, investment interest rate expressed as a percentage (1 by default).
//For example, for a 5% investment rate, this parameter is equal to 5. This rate can't be null.

<Matrix name> // Optional character string, name of the matrix (defined using the MatCreate function) containing the disbursements and collections originating from the investment.

<Row/Column number> // Optional integer, number for the row or column containing the data (1 by default).

<Row/Column> // Optional boolean
True //(by default) if the series of values correspond to a matrix column,
False //if the series of values correspond to a matrix row.

Notes

-Matrix element
//The row or column of the matrix analyzed by the FinNetCurrentVal function must be composed of the following elements :
-Row/Column number, Contents
1 //Amount invested (disbursed): negative
2 //Revenue for year 1: disbursed or collected
3 //Revenue for year 2: disbursed or collected
.....
N-1 //Revenue for year N-2: disbursed or collected
N //Revenue for year N-1: disbursed or collected

-Error management
//Caution : The FinNetCurrentVal function doesn't return an error code.
//To find out if this function has generated any error, use the FinError function.
//The text of the error message can be known by using the ErrorInfo function with the errMessage constant.


FinPaymentNb

Example

Use

//Returns the number of payments required to repay the capital based on a given rate.

// Number of payments required: the payments amount is $7,500,
// the interest rate is 5% and the amount borrowed is $42,000.
PaymentNbrRes = FinPaymentNb(-7500,5, 42000)

Syntax

<Result> = FinPaymentNb([<Payment amount> [,<Rate> [,<Capital>]]])

-Parameters detail

<Result> // Real, number of payments to perform. This number may be :
negative // a payment must be performed;
positive // a credit must be performed.

<Payment amount> // Optional real or currency, amount of one payment (0 by default).
//For a credit, this value must be negative.

<Rate> // Optional real, loan interest rate expressed as a percentage (1 by default).
//For example, for a 5% rate, this parameter is equal to 5.

<Capital> // Optional real or currency, loan amount (1 by default).

Notes

-Error management
//Caution : The FinPaymentNb function doesn't return an error code.
//To find out if this function has generated any error, use the FinError function.
//The text of the error message can be known by using the ErrorInfo function with the errMessage constant.


FinPeriodInterest

Example

Use

//Calculates for a given period the amount of interests due for paying off a loan by fixed periodical payments with a fixed interest rate.

// Amount of interests due for the second year of a loan.
// This is a $25,000 loan with a 5% interest rate over 6 years.
InterestPeriodRes = FinPeriodInterest(25000,5, 2, 6)

Syntax

<Result> = FinPeriodInterest([<Capital> [,<Rate> [,<Period> [,<Duration>]]]])

-Parameters detail

<Result> // Real or currency, amount of interests sought. This amount can be:
negative // a payment must be performed;
positive // a credit must be performed.

<Capital> // Optional real or currency, loan amount (0 by default).

<Rate> // Optional real, loan interest rate expressed as a percentage (1 by default).
//For example, for a 5% rate, this parameter is equal to 5.

<Period> // Optional integer, period over which the interest amount must be calculated (1 by default).

<Duration> // Optional real, number of periods in the loan (1 by default).

Notes

-Time unit
//Calculations can be performed based on months or years.
<Rate>, <Duration> and <Period> // must simply use the same time unit.

//This way, to obtain the amount of interests due on the 5th month of a 3-year loan,
// with an annual interest rate of 5%, you can use :
//either units expressed in months (for monthly payments for example):
<Duration> = 3 * 12 months = 36
<Period> = 5
<Rate> = 5% / 12
//or units expressed in years (for yearly payments for example):
<Duration> = 3 years
<Period> = 5/36
<Rate> = 5%

-Error management
//Caution : The FinPeriodInterest function doesn't return an error code.
//To find out if this function has generated any error, use the FinError function.
//The text of the error message can be known by using the ErrorInfo function with the errMessage constant.


FinRedemption

Example

Use

//Creates a redemption matrix for a fixed rate loan over a defined time period.

// Amortization matrix for an interest only loan of $25,000
// with a fixed interest rate of 5% over 6 years
AmortizationRes = FinRedemption("AmortizeMatrix", finInFine,25000, 5, 6)

Syntax

<Result> = FinRedemption(<Matrix name>, <Amortization type> [,<Capital> [,<Rate> [,<Duration>]]])

-Parameters detail

<Result> // Boolean
True //if the matrix has been created,
False //otherwise.

<Matrix name> // Character string, name of the amortization matrix.
//This matrix is automatically created when calculating the amortization.
//This matrix has 5 columns.
//Each column corresponds to a specific piece of information:

-Column number, Contents
1 //Year
2 //Remain to pay
3 //Interest
4 //Amortization
5 //Yearly payment

<Amortization type> // Constant, specifies the amortization type :
finInFine //Interest only : During the entire length of the loan, the borrower only pays the interests, the principal is reimbursed the last year of the loan.
finConstantRedemption //Amortization constant : Each year the amortization amount is fixed ; the other parameters are calculated accordingly.
finConstantAnnualPayment //Fixed yearly payment : Each year, the borrower pays the lender the same amount, including principal and interests.

<Capital> // Optional real or currency, total capital borrowed.

<Rate> // Optional real, loan interest rate expressed as a percentage (1 by default).
//For example, for a 5% rate, this parameter is equal to 5.

<Duration> // Optional real, life of the loan expressed in years (1 by default).

Notes

-Amortization matrix
//The existence of the matrix is not checked.
//If the matrix already existed, it is overwritten.
//To test if a matrix already exists, use the MatExist function.

//The matrix content can then be read using the following functions :
MatRead // Reads the value of a matrix element.
MatReadColumn // Reads the value of all the elements of a matrix column.
MatReadLine // Reads the value of all the elements of a matrix row.

-Error management
//The FinRedemption function returns False in case of an error.
//To find out the error label, use the WINDEV_RTFLIEorInfo function with the errMessage constant.


FinRepayVal

Example

Use

//Returns the amount of each regular payment of an investment with fixed interest rate and payment.

-Note :
//The value returned by FinRepayVal includes the repayment of the principal and the interests.

// Amount of the regular payments. The initial capital is $100,000.
// The payments are paid each month for 2 years.
// The interest rate is 8%.
RepayValueRes = FinRepayVal(100000, 24, 8)

Syntax

<Result> = FinRepayVal([<Initial capital> [, <Number of periods> [,<Rate>]]])

-Parameters detail

<Result> //: Real or currency, future value of the investment.

<Initial capital> // Optional real or currency, initial capital (0 by default).
//This parameter specifies the amount on which the calculation must be performed.
//In the "standard" case for a borrower, this capital is borrowed and is therefore a negative value.
//If this parameter is positive, the calculation is performed for a lender.
//The value returned is negative: this value corresponds to the amount to pay.

<Number of periods> // Optional integer, total number of periods for the operation (1 by default).

<Rate> // Optional real, investment interest rate expressed as a percentage (1 by default).
//For example, for a 5% investment rate, this parameter is equal to 5.

Notes

-Time unit
//Calculations can be performed based on months or years.
<Rate> and <Period> // parameters must simply use the same time unit.

//Therefore, for monthly payments of a 4-year loan with a 12% annual interest rate, use:
<Rate> = 12% / 12,
<Number of periods> = 4*12
//If, for the same loan, your payments are yearly, use:
<Rate> = 12%,
<Number of periods> = 4

//For all the parameters, the disbursements are represented by a negative number while the collections are represented by a positive number.

-Error management
//Caution : The FinFuturVal function doesn't return an error code.
//To find out if this function has generated any error, use the FinError function.
//The text of the error message can be known by using the ErrorInfo function with the errMessage constant.


GetIdentifier

GetIndentifier

Use

//Calculates a unique identifier of integer type for a given executable. This data is not stored: it is lost when the application is done.

// Obtain an order number
i = GetIdentifier()

Syntax

<Result> = GetIdentifier()

-Parameters detail

<Result> // Integer, Identifier.
//The first call to GetIdentifier returns 1, the second 2, etc.


HiWord

Use

//Returns the two low bytes of an integer.

Res is int = CursorPos(cpClient)
IF Res <>-1 THEN
Aresult("Position X = " + LoWord(Res)+...
"Position Y = " + HiWord(Res))
END

Syntax

<Result> = HiWord(<Value>)

-Parameters detail

<Result> // Integer, the 2 high bytes.

<Value> // Integer, value whose high bytes are sought.
// If this value is a numeric type other than integer, this value is automatically converted into an integer.
//If this value is a character string, an error is displayed.

Notes

-Miscellaneous
//The & operator is used to find out the address of a variable.
//The HiWord function can be used to retrieve the high bytes of an integer returned by the API or CallDLL32 function.
//The LoWord function is used to retrieve the low bytes of an integer.


Info

Use

//Displays a custom message in a system information window.

//To close the window, the user must validate the OK button.

Name is A string = "Florence"
Info("Hi" + Name+ CR+ "Welcome!")

Syntax

Info(<Text> [, <Line 2> ... [, <Line n>]])

-Parameters detail

<Text> // Character string, text to print

<Line 2> ... <Line n> // Optional character strings, text displayed on the following lines.

Notes

-Characteristics of the dialog box
//The title of the dialog box is the title of the current window.
//The message is aligned to the left.
//The button's label is based on the Windows execution language.
//The maximum number of characters displayed is limited to 4096.
//If a larger string is passed as a parameter, it will be truncated.
//The icon displayed cannot be modified (exclamation mark).

-Line break in the dialog box
//The CR (Carriage Return) pre-defined string can be used to force a break to the next line.
//For example:
Info("The form XXX has been modified." + CR +...
"Do you want to save the changes?")
//is equivalent to:
Info("The form XXX has been modified.",...
"Do you want to save the changes?")


InitRandom

Use

//Initializes the random number generator.

// Initialize the random number generator
InitRandom()

Syntax

InitRandom([<n>])

-Parameter detail

<n> // Integer, base number of the random number generator.
//If this parameter is not specified, the random number generator is based on the system time (hundredth of second)

Notes

-Random number
//If the InitRandom function isn't called, the random values generated by the Random function will be the same every time the program is run.
//Calls to InitRandom that are very close in time will return identical sequences because InitRandom uses the system time to generate series of random numbers.


IntegerPart

Use

//Returns the integer part of a number.

// Integer part of 16.999
IntegerPartRes = IntegerPart(16.999)
// Returns 16
// To get 17, use the Round function

Syntax

<Result> = IntegerPart(<Number>)

-Parameters detail

<Result> // Integer, decimal part sought.
//Corresponds to the largest integer smaller than or equal to <Number>.

<Number> //Real, number to use.


IsEven

Use

//Identifies an even number.

// Even number?
EvenRes = IsEven(66) // Returns True
EvenRes = IsEven(6 + 13) // Returns False

Syntax

<Result> = IsEven(<Number>)

-Parameters detail

<Result> // Boolean
True //if the specified number is even,
False //otherwise.

<Number> // Integer numeric expression or integer number, integer numeric expression or integer number to identify.

Notes

-The number zero
//Zero is considered an even number.


IsOdd

Use

//Identifies an odd number.

// Odd number?
OddRes = IsOdd(65) // Returns True
OddRes = IsOdd(5 + 11) // Returns False

Syntax

<Result> = IsOdd(<Number>)

-Parameters detail

<Result> // Boolean
True //if the specified number is odd,
False //otherwise.

<Number> // Integer numeric expression or integer number, integer numeric expression or integer number to identify.


Left

Use

//Extracts the left part of a character string (i.e. the first characters).

Left("The dog", 3) // Returns "The"
Left("ABC", 50) // Returns "ABC"
Left(" AZELMA") // Returns "AZELMA"

Syntax

<Result> = Left(<Source string> [, <Length>])

-Parameters detail

<Result> // Character string, specified left part of <Source string>.
//Corresponds to <Source string> if the <Length> parameter is greater than the size of <Source string>.
EOT // if the <Length> parameter is negative.

<Source string> // Character string, character string which left part must be extracted.
//This string is not truncated.

<Length> // Optional integer, number of characters to extract.
//If this parameter is not specified, <Result> corresponds to <Source string> without the spaces on the right.


Length

Use

//Returns the size of a character string, which is the number of characters composing the string (including the space characters and binary 0).

Length("Quasimodo") // Returns 9
Length(" Quasimodo ") // Returns 11
Length("A" + Charact(0)) // Returns 2
Length("") // Returns 0
Length(" ") // Returns 1

Syntax

<Result> = Length(<Source string>)

-Parameters detail

<Result> // Integer, number of character making up the string.

<Source string> // Character string, character string which size must be calculated.


Ln

Use

//Calculates the Napierian logarithm of a numeric value (inverse of the exponential function).

// Calculate the Napierian logarithm for 12
NapierianLogRes = Ln(12)
// Returns 2.48490664979

Syntax

<Result> = Ln(<Numeric value>)

-Parameters detail

<Result> // Real, napierian logarithm sought.

<Numeric Value> // Integer or real, numeric value to use.
//If this parameter is a negative or null number, a W-Language error occurs.


Log

Use

//Calculates the logarithm of a numeric value.

// Calculate the logarithm for 10
LogRes = Log(10)
// Returns 1

Syntax

<Result> = Log(<Numeric value>)

-Parameters detail

<Result> // Real, logarithm sought.

<Numeric Value> // Integer or real, numeric value to use.
//If this parameter is a negative or null number, a W-Language error occurs.


Lower

Use

//Converts a character string into lowercase based on the localization parameters defined in Windows.

Lower("ABCD") // Returns "abcd"
Lower("ÇA !") // Returns "ça !"
Lower("Pierre and Paul") // Returns "pierre and paul"

Syntax

<Result> = Lower(<Character string>)

-Parameters detail

<Result>// Character string, character string in lowercase.

<Character string> // Character string, character string to convert into lowercase.

Notes

-Conversion rules
//Non accented lowercase letters remain as non accented lowercase letters.
//Accented lowercase letters remain as accented lowercase letters.
//Non accented uppercase letters are transformed into non accented lowercase letters.
//Accented uppercase letters remain as accented uppercase letters.

-Miscellaneous
//"Blanks" remain the same.


LoWord

Use

//Returns the two low bytes of an integer.

Res is int = CursorPos(cpClient)
IF Res <>-1 THEN
Aresult("Position X = " + LoWord(Res)+...
"Position Y = " + HiWord(Res))
END

Syntax

<Result> = LoWord(<Value>)

-Parameters detail

<Result> // Unsigned integer coded on 2 bytes, The 2 low bytes.

<Value> // Integer, value whose low bytes are sought.
//If this value is a numeric type other than integer, this value is automatically converted into an integer.
//If this value is a character string, an error is displayed.

Notes

-Miscellaneous
//The & operator is used to find out the address of a variable.
//The LoWord function can be used to retrieve the low bytes of an integer returned by the API or CallDLL32 function.
//The HiWord function is used to retrieve the high bytes of an integer.


MatAdd

Example

Use

//Adds two matrices of the same dimension (same number of rows and same number of columns).

// Add two matrices
AdditionRes = MatAdd("MyMatrix1", "MyMatrix2", "MyMatrixResult")

Syntax

<Result> = MatAdd(<Name of first matrix>, <Name of second matrix>, <Name of the result matrix>)

-Parameters detail

<Result> // Boolean
True //if the addition was performed,
False //otherwise.

<Name of first matrix> // Character string, name of the first matrix to add, defined using the MatCreate function.

<Name of second matrix> // Character string, name of the second matrix to add, defined using the MatCreate function.

<Name of result matrix> // Character string, name of the matrix that contains the addition result.
//This matrix is automatically created when adding two matrices.

Notes

-Existence of the result matrix
//The existence of the matrix is not checked.
//If the matrix already existed, it is overwritten.
//To test if a matrix already exists, use the MatExist function.

-Identical matrices
//If the <Name of the first matrix> is identical to the <Name of the second matrix>,
//the resulting matrix contains twice the original matrix.

-Subtracting matrices
//To subtract a matrix from another matrix, simply :
//multiply the matrix to subtract by -1 using the MatFloatMultiply function,
//then add the resulting matrix to the first matrix.

-Error management
//The MatAdd function returns False in case of an error.
//To find out the error label, use the ErrorInfo function with the errMessage constant.


MatCopy

Example

Use

//Creates a copy of a matrix. The new matrix has the same dimension as the base matrix. All the elements of the original matrix are copied into the new matrix.

// copy matrix
CopyRes = MatCopy("MyMatrix", "MyMatrixCopy")

Syntax

<Result> = MatCopy(<Name of matrix to copy>, <Name of the copied matrix>)

-Parameters detail

<Result> // Boolean
True //if the matrix has been copied
False //otherwise.

<Name of matrix to copy> // Character string, name of the matrix to copy, defined using the MatCreate function.

<Name of the copied matrix> // Character string, name of the copied matrix.
//This matrix is automatically created during the copy.

Notes

-Existence of the copied matrix
//The existence of the matrix is not checked.
//If the matrix already existed, it is overwritten.
//To test if a matrix already exists, use the MatExist function.

-Error management
//The MatCopy function returns False in case of an error.
//To find out the error label, use the ErrorInfo function with the errMessage constant.


MatCreate

Example

Use

//Creates a matrix with 0 row and 0 column.

// Create matrix
CreationRes = MatCreate("MyMatrix")

Syntax

<Result> = MatCreate(<Matrix name>)

-Parameters detail

<Result> // Boolean
True //if the matrix has been created,
False //otherwise.

<Matrix name> // Character string, name of the matrix to create.
//This name will be used by all the matrix management functions.

Notes

-Matrix existence
//The existence of the matrix is not checked.
//If the matrix already existed, it is overwritten.
//To test if a matrix already exists, use the MatExist function.

-Error management
//The MatCreate function returns False in case of an error.
//To find out the error label, use the ErrorInfo function with the errMessage constant.


MatDelete

Example

Use

//Deletes an existing matrix. Deleting an unused (or null) matrix from an application enables you to free the memory space taken by this matrix.

-Note :
//All the matrices used in an application are automatically deleted when closing the application.

// Matrix deletion
MatDelete("MyMatrix")

Syntax

MatDelete(<Matrix name>)

-Parameter detail

<Matrix name> //: Character string, name of the matrix to deleted, defined using the MatCreate function.

Notes

-Existence of the matrix to delete
//The existence of the matrix is not checked.
//To test if a matrix already exists, use the MatExist function.
//If the matrix doesn't exist, the MatDelete function has no effect.


MatDeterminant

Example

Use

//Calculates the determinant of a square matrix (the number of rows is equal to the number of columns).

// Calculate a matrix determinant
DeterminantRes =MatDéterminant("MyMatrix")

Syntax

<Result> = MatDéterminant(<Matrix name>)

-Parameters detail

<Result> // Real, matrix determinant. If this value is equal to 0, the matrix determinant is null.

<Matrix name> // Character string, name of the matrix to use, defined using the MatCreate function.

Notes

-Matrix existence
//The existence of the matrix is not checked.
//To test if a matrix already exists, use the MatExist function.

-Error management
//Caution : The MatDeterminant function doesn't return an error code.
//To find out if errors occurred when calculating the determinant, use the MatError function.
//The text of the error message can be known by using the ErrorInfo function with the errMessage constant.


MatError

Example

Use

//Identifies the type of the last error triggered by a Matxxx function (matrix management functions).

// Identify the error type
ErrorRes = MatError("MyMatrix")

Syntax

<Result> = MatError(<Matrix name>)

-Parameters detail

<Result> // Integer
0 //if no error occurred on the last matrix function or
//an error code (value greater than 0) otherwise.

<Matrix name> // Character string, name of the matrix used, defined using the MatCreate function.

Notes

-Error code
//The error codes that can occur with matrix functions are :
8 // Not enough memory available.
9 // Position requested is outside the matrix.
10 // Invalid matrix name..
11 // Matrices have different dimensions.
12 // Null determinant. Cannot calculate matrix inverse.

-Caution :
//Errors 9, 10 and 11 generate a W-Language error. The application is stopped.

-Matrix existence
//The existence of the matrix is not checked.
//To test if a matrix already exists, use the MatExist function.


MatExist

Example

Use

//Tests if a matrix exists in memory.

// Test if the matrix exists
ExistRes = MatExist("MyMatrix")

Syntax

<Result> = MatExist(<Matrix name>)

-Parameters detail

<Result> // Boolean
True //if the matrix exists,
False //otherwise.

<Matrix name> // Character string, name of the matrix to test, defined using the MatCreate function.

Notes

-Matrix existing in memory
//A matrix may be created using several ways :
//using the MatCreate function
//copying another matrix (MatCopy function),
//adding up two matrices (MatAdd function),
//multiplying two matrices (MatMultiply function),
//by creating the transposed matrix (MatTranspose function),
//by creating the inverse matrix (MatInvert function),

-A matrix may be deleted :
//using the MatDelete function,
//when closing the application.

-Error management
//The MatExist function returns False in case of an error.
//To find out the error label, use the ErrorInfo function with the errMessage constant.


MatFill2

Example

Use

//Initializes all the elements of a given size matrix. If the matrix is larger, only the specified elements are filled.

// Fill a 2-row, 3-column matrix with the number 5
FillRes = MatFill2("MyMatrix", 5, 2, 3)

//Initialize all the matrix elements with the value 5. This matrix has 2 rows and 3 columns:
FillRes = MatFill2("MyMatrix", 5, 2, 3)

//Initialize the elements of row 1 to 2 and column 1 to 4 of a matrix with the value 5. Only part of the matrix is initialized:
FillRes = MatFill2("MyMatrix", 5, 2, 3)

Syntax

<Result> = MatFill2(<Matrix name>, <Value>, <Number of rows>, <Number of columns>)

-Parameters detail

<Result> // Boolean
True //if the matrix has been filled,
False //otherwise.

<Matrix name> // Character string, name of the matrix to fill, defined using the MatCreate function.

<Value> // Real , value given to all the elements of a matrix.

<Number of rows> // Integer, number of rows to fill.

<Number of columns> // Integer, number of columns to fill.

Notes

-Matrix existence
//A matrix must exist before it can be filled.
//To test if a matrix already exists, use the MatExist function.

-Error management
//The MatFill2 function returns False in case of an error.
//To find out the error label, use the ErrorInfo function with the errMessage constant.


MatFloatAdd

Example

Use

//Adds a value to each matrix element. This addition is performed directly in the specified matrix.

// Add the value 3 to a matrix
MatFloatAdd("MyMatrix", 3)

Syntax

MatFloatAdd(<Matrix name>, <Value>)

-Parameters detail

<Matrix name> // Character string, name of the matrix to use, defined using the MatCreate function.

<Value> // Real, value to add to the matrix.

Notes

-Matrix existence
//The existence of the matrix is not checked.
//To test if a matrix already exists, use the MatExist function.

-Error management
//Caution : The MatFloatAdd function doesn't return an error code.
//To find out is this function genrated an error, use the ErrorInfo function with the errMessage constant.


MatFloatMultiply

Example

Use

//Multiplies each matrix element by a value. This multiplication is performed directly in the specified matrix.

// Multiply the matrix elements by the value 3
MatFloatMultiply("MyMatrix", 3)

Syntax

MatFloatMultiply(<Matrix name>, <Value>)

-Parameters detail

<Matrix name> // Character string, name of the matrix to use, defined using the MatCreate function.

<Value> // Real, value used for the multiplication.

Notes

-Dividing all the elements of a matrix
//To divide all the elements of a matrix by a given value, multiply the matrix by : 1/<Value>.

-Matrix existence
//The existence of the matrix is not checked.
//To test if a matrix already exists, use the MatExist function.

-Error management
//Caution : The MatFloatMultiply function doesn't return an error code.
//To find out if errors occurred when performing the multiplication, use the MatError function.
//The text of the error message can be known by using the ErrorInfo function with the errMessage constant.


MatInvert

Example

Use

//Reverses a square matrix.

-Note :
//The inverse matrix can only be calculated :
//from a square matrix (the number of rows is equal to the number of columns),
//if the determinant (returned by MatDeterminant) is not null.

// Inversing a square matrix
InversionRes = MatInvert("MyMatrix", "MyInversedMatrix")

Syntax

<Result> = MatInvert(<Name of matrix to inverse>, <Name of inversed matrix>)

-Parameters detail

<Result> // Boolean
True //if the inversion was performed,
False //otherwise.

<Name of matrix to inverse> // Character string, name of the matrix to inverse, defined using the MatCreate function.

<Name of inversed matrix> // Character string, name of inversed matrix.
//This matrix is automatically created during the inversion.

Notes

-Inversed matrix existence
//The existence of the matrix is not checked.
//If the matrix already existed, it is overwritten.
// To test if a matrix already exists, use the MatExist function.

-Identical matrices
//A W-Language error is generated if <Name of matrix to inverse> and <Name of inversed matrix> are identical.

-Error management
//The MatInvert function returns False in case of an error.
//To find out if this function generated an error, use the ErrorInfo function with the errMessage constant.


MatMultiply

Example

Use

//Multiplies two matrices.

// Multiplies two matrices
MultiplicationRes = MatMultiply("MyMatrix1", "MyMatrix2", "MyMatrixResult")

Syntax

<Result> = MatMultiply(<Name of first matrix>, <Name of second matrix>, <Name of the result matrix>)

-Parameters detail

<Result> // Boolean
True //if the multiplication has been performed
False //otherwise.

<Name of first matrix> // Character string, name of the first matrix to multiply, defined using the MatCreate function.

<Name of second matrix> // Character string, name of the second matrix to multiply, defined using the MatCreate function.

<Name of result matrix> // Character string, name of the matrix that contains the multiplication result.
//This matrix is automatically created when multiplying two matrices.

Notes

-Matrices multiplication
//To multiply two matrices, the number of columns in the first matrix must be equal to the number of rows in the second matrix.

//The element (row i, column j) of the resulting matrix is obtained by multiplying the ith row of the first matrix by the jth column of the second matrix.

//You can self multiply a matrix.
//To do so, use the same matrix name for <Name of the first matrix> and <Name of the second matrix>.

-Existence of the result matrix
//The existence of the matrix is not checked.
//If the matrix already existed, it is overwritten.
//To test if a matrix already exists, use the MatExist function.

-Error management
//The MatMultiply function returns False in case of an error.
//To find out the error label, use the ErrorInfo function with the errMessage constant.


MatNbLine

Example

Use

//Returns the number of rows in a matrix.

//The number of rows in a matrix varies dynamically.
//It corresponds to the number of rows initialized.
//The number of rows may vary after using the functions :
MatWrite,
MatFill2.

// Number of rows?
NbrLineRes = MatNbLine("MyMatrix")

Syntax

<Result> = MatNbLine(<Matrix name>)

-Parameters detail

<Result> // Integer, number of rows in the specified matrix.

<Matrix name> // Character string, name of the matrix to use, defined using the MatCreate function.

Notes

-Matrix existence
//The existence of the matrix is not checked.
//To test if a matrix already exists, use the MatExist function.

-Error management
//Caution : The MatNbLine function doesn't return an error code.
//To find out if errors occurred when returning the number of lines, use the MatError function.
//The text of the error message can be known by using the ErrorInfo function with the errMessage constant.


MatNbRow

Example

Use

//Returns the number of columns in a matrix.

//The number of columns in a matrix varies dynamically.
//It corresponds to the number of columns initialized.
//The number of columns may vary after using the functions:
MatWrite,
MatFill2.

// Number of columns?
NbrRowRes = MatNbRow("MyMatrix")

Syntax

<Result> = MatNbRow(<Matrix name>)

-Parameters detail

<Result> // Integer, number of columns in the specified matrix.

<Matrix name> // Character string, name of the matrix to use, defined using the MatCreate function.

Notes

-Matrix existence
//The existence of the matrix is not checked.
//To test if a matrix already exists, use the MatExist function.

-Error management
//Caution : The MatNbRow function doesn't return an error code.
//To find out if errors occurred when returning the number of rows, use the MatError function.
//The text of the error message can be known by using the ErrorInfo function with the errMessage constant.


MatRead

Example

Use

//Reads the value of a matrix element.

-Reminder :
//A matrix element is identified by its row and column.

// Reading the element (row 3, column 5)
ReadRes = MatRead("MyMatrix", 3, 5)

Syntax

<Result> = MatRead(<Matrix name>, <Element row>, <Element column>)

-Parameters detail

<Result> // Real, value of the element read.

<Matrix name> // Character string, name of the matrix to test, defined using the MatCreate function.

<Element row> //: Integer, row number of the element to read.

<Element column> // Integer, column number of the element to read.

Notes

-Matrix existence
//The existence of the matrix is not checked.
//To test if a matrix already exists, use the MatExist function.

-Error management
//Caution : The MatRead function doesn't return an error code.
//To find out if errors occurred when reading an element, use the MatError function.
//The text of the error message can be known by using the ErrorInfo function with the errMessage constant.


MatReadColumn

MatReadComlumn

Example

Use

//Reads the value of all the elements of a matrix column.

// Read elements in column 5
ReadColumnRes = MatReadColumn("MyMatrix", 5)

Syntax

<Result> = MatReadColumn(<Matrix name>, <Column to read> [,[<Element total size>][. <Number of decimal places>]<Element format>])

-Parameters detail

<Result> // Character string, value of all the elements of the specified column, in the format :
<Element1Value>+TAB+<Element2Value>+TAB+...+TAB+<ElementNValue>

<Matrix name> // Character string, name of the matrix to test, defined using the MatCreate function.

<Column to read> // Integer, number of the column to read.

<Element total size> // Optional integer, element total size.
//This size includes the sign, the thousand separator, the decimal point, the exponent, the integer and decimal parts of the element value.
//If the element has more than <Element total size> digits, the <Element total size> is increased.
//If the element has less than <Element total size> digits, the <Result> character string is completed by spaces.
//If the <Element total size> isn't specified, the value of the element read will have the size of its significant part.
//The <Element total size> shouldn't be over 100.
//If the <Element total size> is 0, the value of the element will have the size of its significant part.

<Number of decimal places> // Optional integer, number of decimal places to read.
//This parameter always start with a point (".").
//The decimal part will be rounded.
//This parameter only affects floating notations ("f") and exponentiation ("e" and "E").
//If the <Number of decimal places> is larger than the <Element total size>, the <Element total size> parameter isn't taken into account.

<Element format> // Optional character, Element presentation format :
d // the element value is in the form of a signed integer.
// The digits after the decimal point are cut out and the <Number of decimal places> parameter is ignored.

e or E // the element value is in the form of an exponential notation with 1 digit before the decimal point,
// <Number of decimal places> digits after the decimal point and at least 2 digits in the exponent.

Notes

-Matrix existence
//The existence of the matrix is not checked.
//To test if a matrix already exists, use the MatExist function.

-<Result> size
//Caution : the size of the character string obtained in <Result> is limited to 260 characte//If the matrix column contains more characters, the string contained in <Result> will only have the first 260 characters.

-Extracting a value from a <Result> element
//To extract one or more element values from the <Result> character string, use the ExtractString function.

-Error management
//Caution : The MatReadColumn function doesn't return an error code.
//To find out if errors occurred when reading a column's elements, use the MatError function.
//The text of the error message can be known by using the ErrorInfo function with the errMessage constant.


MatReadLine

Example

Use

//Reads the value of all the elements of a matrix row.

// Read elements in row 5
ReadRowRes = MatReadLine("MyMatrix", 5)

Syntax

<Result> = MatReadLine(<Matrix name>, <Row to read> [,[<Element total size>][. <Number of decimal places>]<Element format>])

-Parameters detail

<Result> // Character string, value of all the elements of the specified row, in the format :
<Element1Value>+TAB+<Element2Value>+TAB+...+TAB+<ElementNValue>

<Matrix name> // Character string, name of the matrix to test, defined using the MatCreate function.

<Row to read> // Integer, number of the row to read.

<Element total size> // Optional integer, element total size.
//This size includes the sign, the thousand separator, the decimal point, the exponent, the integer and decimal parts of the element value.
//If the element has more than <Element total size> digits, the <Element total size> is increased.
//If the element has less than <Element total size> digits, the <Result> character string is completed by spaces.
//If the <Element total size> isn't specified, the value of the element read will have the size of its significant part.
//The <Element total size> shouldn't be over 100.
//If the <Element total size> is 0, the value of the element will have the size of its significant part.

<Number of decimal places> // Optional integer , number of decimal places to read.
//This parameter always start with a point (".").
//The decimal part will be rounded.
//This parameter only affects floating notations ("f") and exponentiation ("e" and "E").
//If the <Number of decimal places> is larger than the <Element total size>, the <Element total size> parameter isn't taken into account.

<Element format> // Optional character, element presentation format :
d // the element value is in the form of a signed integer.
// The digits after the decimal point are cut out and the <Number of decimal places> parameter is ignored.
e or E // exponential notation with 1 digit before the decimal point, <Number of decimal places> digits after the decimal point and at least 2 digits for the exponent.

Notes

-Matrix existence
//The existence of the matrix is not checked.
//To test if a matrix already exists, use the MatExist function.

-<Result> size
//Caution : the size of the character string obtained in <Result> is limited to 260 characters.
//If the matrix row contains more characters, the string contained in <Result> will orst 260 characters.

-Extracting a value from a <Result> element
//To extract one or more element values from the <Result> character string, use the ExtractString function.

-Error management
//Caution : The MatReadLine function doesn't return an error code.
//To find out if errors occurred when reading a row's elements, use the MatError function.
//The text of the error message can be known by using the ErrorInfo function with the errMessage constant.


MatStack

Example

Use

//Compresses the amount of memory space occupied by the matrix.

-Note :
//Compressing is necessary if you're using a large size matrix on which many calculations have been performed. If this matrix has several columns and/or rows that are null, compressing lets you reduce the memory footprint noticeably.

// Matrix compression
MatStack("MyMatrix")

Syntax

MatStack(<Matrix name>)

-Parameter detail

<Matrix name> // Character string, name of the matrix to compress, defined using the MatCreate function.

Notes

-Existence of the matrix to compress
//The existence of the matrix is not checked.
//To test if a matrix already exists, use the MatExist function.

-Error management
//Caution : The MatStack function doesn't return any result.
//To find out if errors have occurred during the compress operation, use the MatError function on this matrix.
//The text of the error message can be known by using the ErrorInfo function with the errMessage constant.


MatTranspose

Example

Use

//Calculates a matrix transposition.

//A matrix transposition is obtained by switching the row into columns.
//If the source matrix is a matrix with n rows and m column, then the transposed matrix is a matrix with m rows and n columns.

// Matrix transposition
TransposeRes = MatTranspose("MyMatrix", "MyTransposedMatrix")

Syntax

<Result> = MatTranspose(<Name of matrix to transpose>, <Name of transposed matrix>)

-Parameters detail

<Result> // Boolean
True // if the matrix transposition has been calculated,
False // otherwise.

<Name of matrix to transpose> // Character string, name of the matrix to transpose, defined using the MatCreate function.

<Name of transposed matrix> // Character string, name of transposed matrix.
//This matrix is automatically created when calculating the transposition.

Notes

-Transposed matrix existence
//The existence of the matrix is not checked.
//If the matrix already existed, it is overwritten.
//To test if a matrix already exists, use the MatExist function.

-Identical matrices
//A W-Language error is generated if <Name of matrix to transpose> and <Name of transposed matrix> are identical.

-Error management
//The MatTranspose function returns False in case of an error.
//To find out the error label, use the ErrorInfo function with the errMessage constant.


MatWrite

Example

Use

//Writes an element into a matrix.

// Assigning the value 6 to the element (row 2, column 2)
WriteRes = MatWrite("MyMatrix", 6, 2, 2)

Syntax

<Result> = MatWrite(<Matrix name>, <Value>, <Element row>, <Element column>)

-Parameters detail

<Result> // Boolean
True // if the write operation was performed,
False // otherwise.

<Matrix name> // Character string, name of the matrix to use, defined using the MatCreate function.

<Value> // Real, value given to the specified element.

<Element row> // Integer, row of the element to initialize.

<Element column> // Integer, column of the element to initialize.

Notes

-Matrix existence
//A matrix must exist before it can be filled.
//To test if a matrix already exists, use the MatExist function.

-Matrix size
//The matrix size is dynamically managed.
//If the coordinates (row and columns) of the element to insert into the matrix are greater than the matrix dimension (total width and total height of the matrix), the element is added at the specified position. In this case, the matrix is completed with zeros.
//For example :
MatWrite("MyArchive", 9, 2, 4)

-Error management
//The MatWrite function returns False in case of an error.
//To find out the error label, use the ErrorInfo function with the errMessage constant.


Max

Use

//Returns the largest of the values passed as parameters.

// Largest value?
MaxRes = Max(10, 15, 20) // Returns 20
MaxRes = Max("Z", "A") // Returns "Z"

Syntax

<Result> = Max(<Value 1>, <Value 2> [, <Value N>])

-Parameters detail

<Result> // Character string, integer or real, the largest of the values passed as parameters.

<Value 1>/<Value 2>/<Value N> // Character string, integer or real, value to compare.


MemAdd

Use

//Adds an element into a memory zone.

// Adds the value of the Client.Name item into the "MemZone" memory zone
// The value returned will be the record number of this item
MemAdd("MemZone", Client.Name, HRecNum(Client))

Syntax

MemAdd(<Memory zone name>, <Value added>, <Value returned>)

-Parameters detail

<Memory zone name> // Character string, name of the memory zone, defined by the MemCreate function.

<Value added> // Character string, integer or real, value added into the memory zone.
//This value corresponds to the sort argument used by the MemSort function. You can retrieve this value using the MemKeyVal function.

<Value returned> // Character string, value which will be returned by the MemRetrieve or MemSetPosition functions.

Notes

-Existence of the memory zone
//The existence of the memory zone is not checked.
//If the memory zone <Memory zone name> doesn't exist, a W-Language error is generated while executing the MemAdd function.
//To test if a memory zone exists, use the MemExist function.

-Sorting elements
//The element added into the memory zone is not sorted.
//You must use the MemSort function to sort the entire memory zone.


MemCount

Use

//Returns the number of elements found in a memory zone.

// Number of elements found in the memory zone "MyMemoryZone"
CountRes= MemCount("MyMemoryZone")

Syntax

<Result> = MemCount(<Memory zone name>)

-Parameters detail

<Result> // Integer, number of elements found in the specified memory zone.

<Memory zone name> // Character string, name of the memory zone, defined by the MemCreate function.

Notes

-Existence of the memory zone
//The existence of the memory zone is not checked.
//If the memory zone <Memory zone name> doesn't exist, a W-Language error is generated while executing the MemCount function.
//To test if a memory zone exists, use the MemExist function.


MemCreate

Use

//Creates a memory zone. This memory zone may contain text or numeric type information.

// Creating a memory zone
MemCreate("MyMemoryZone")

Syntax

MemCreate(<Memory zone name>)

-Parameter detail

<Memory zone name> // Character string, name of the memory zone to create (maximum 20 characters).
//This name will be used by all the memory zone management functions.

Notes

-Existence of the memory zone
//The existence of the memory zone is not checked.
//If the memory zone already existed, this memory zone is overwritten.
//To test if a memory zone exists, use the MemExist function.

-Information size
//If the size of the information to store in the memory zone is larger than the available memory space, WinDev uses a swap disk: WinDev creates one or more temporary files to store the extra information. These temporary files are created on the local drive, in the directory specified in the "TEMP" environment variable.


MemCurrent

Use

//Returns the index of the current element.

// Index of the current element in the "MemoryZone" memory zone
IndexRes = MemCurrent("MemoryZone")

Syntax

<Result> = MemCurrent(<Memory zone name>)

-Parameters detail

<Result> // Integer, index of the current element of the specified memory zone.

<Memory zone name> // Character string, name of the memory zone, defined by the MemCreate function.

Notes

-Modification of the current element
//The MemSetPosition, MemFirst, MemLast, MemNext, MemPrevious and MemSeek functions modify the current element.

-Existence of the memory zone
//The existence of the memory zone is not checked.
//If the memory zone <Memory zone name> doesn't exist, a W-Language error is generated while executing the MemCurrent function.
//To test if a memory zone exists, use the MemExist function.


MemDelete

Use

//Deletes an element from a memory zone.

// Deletes all the null values of the "MemoryZone" memory zone
SeekRes= MemSeek("MemoryZone", 0)
WHILE MemOut = False
MemDelete("MemoryZone", MemCurrent("MemoryZone"))
MemNext("MemoryZone")
END

Syntax

MemDelete(<Memory zone name>, <Index>)

-Parameters detail

<Memory zone name> // Character string, name of the memory zone, defined by the MemCreate function.

<Index> // Integer, index of the element to delete.
//The index of an element can be obtained by using the MemCurrent or MemSeek functions.

Notes

-Deletion
//Simple deletion : after executing the MemDelete function, the next element is pointed to.

//Deletion with seek : if the deletion is performed on elements sought by the MemSeek function, use :
//- the MemNext function to point to the next element sought.
//- the MemPrevious function to point to the previous element sought.

-Existence of the memory zone
//The existence of the memory zone is not checked.
//If the memory zone <Memory zone name> doesn't exist, a W-Language error is generated while executing the MemDelete function.
//To test if a memory zone exists, use the MemExist function.


MemDeleteAll

Use

//Empties and deletes a memory zone.

// Deleting the memory zone "MyMemoryZone"
MemDeleteAll("MyMemoryZone")

Syntax

MemDeleteAll(<Memory zone name>)

-Parameter detail

<Memory zone name> // Character string, name of the memory zone to delete, defined by the MemCreate function.
//If this parameter is a star ("*"), all the memory zones previously created are deleted.

Notes

-Existence of the memory zone
//The existence of the memory zone is not checked.
//If the memory zone <Memory zone name> doesn't exist, a W-Language error is generated while executing the MemDeleteAll function.
//To test if a memory zone exists, use the MemExist function.


MemExist

Use

//Tests if a memory zone exists.

// Test if the "MyMemoryZone" memory zone exists
ExistRes = MemExist("MyMemoryZone")

Syntax

<Result> = MemExist(<Memory zone name>)

-Parameters detail

<Result> // Boolean
True // if the memory zone exists
False // otherwise.

<Memory zone name> // Character string, name of the memory zone, defined by the MemCreate function.

Notes

-Memory zone
//In order to exist, a memory zone must have been created by the MemCreate function.
//A memory zone can be destroyed using the MemDeleteAll function.


MemFirst

Use

//Points to the first element of a memory zone and returns the value of this element.

// Points to the first element of the memory zone
// "MyMemoryZone" and returns the value of this element
FirstRes = MemFirst("MyMemoryZone")

Syntax

<Result> = MemFirst(<Memory zone name>)

-Parameters detail

<Result> // Any type
//If the memory zone is not empty : returned value of the first element, defined by the MemAdd or MemModify functions.
//If the memory zone is empty : an empty string (" ").

<Memory zone name> // Character string, name of the memory zone, defined by the MemCreate function.

Notes

-Sorting the memory zone
//Sort operations performed using the MemSort function apply when calling the MemFirst function.
//If no sorting was requested, the MemFirst function returns the value of the first element added by the MemAdd function.

-Existence of the memory zone
//The existence of the memory zone is not checked.
//If the memory zone <Memory zone name> doesn't exist, a W-Language error is generated while executing the MemFirst function.
//To test if a memory zone exists, use the MemExist function.

-Equivalence
//The following two syntax are equivalent :
Res = MemFirst(<Memory zone name>)
Res = MemRetrieve(<Memory zone name>, 1)


MemFound

Use

//Checks if the element sought was found.

// was the element found in the memory zone "MemoryZone?
FoundRes = MemFound("MemoryZone")

Syntax

<Result> = MemFound(<Memory zone name>)

-Parameters detail

<Result> // Boolean
True // if the element sought was found,
False // otherwise.

<Memory zone name> // Character string, name of the memory zone, defined by the MemCreate function.

Notes

-Calling the MemFound function
//The MemFound function must only be called after the MemSeek, MemFirst, MemLast, MemPrevious and MemNext functions.

-Checks
//You cannot use the MemFound function to perform multiple checks.
//For example, the MemFound function can't be used as follows :

MemSeek("DaysZone", ValueSought)
WHILE MemFound("DaysZone") = True
MemNext("DaysZone")
END

//This is because the seek action performed are identical searches and the MemFound function, in this case, behaves similarly to the MemOut function. In our example, the MemFound function returns False (the end of the memory zone hasn't been reached).
//The following search commands will not be performed.

-Existence of the memory zone
//The existence of the memory zone is not checked.
//If the memory zone <Memory zone name> doesn't exist, a W-Language error is generated while executing the MemFound function.
//To test if a memory zone exists, use the MemExist function.


MemKeyVal

Use

//Returns the added or modified (using the MemAdd or MemModify functions) value of the current element in a memory zone.

// Retrieve the value of the current element
// in the memory zone "MyMemoryZone"
ValueRes = MemKeyVal("MyMemoryZone")

Syntax

<Result> = MemKeyVal(<Memory zone name>)

-Parameters detail

<Result> // Character string, value added using the MemAdd function or modified using the MemModify function.

<Memory zone name> // Character string, name of the memory zone, defined by the MemCreate function.

Notes

-Existence of the memory zone
//The existence of the memory zone is not checked.
//If the memory zone <Memory zone name> doesn't exist, a W-Language error is generated while executing the MemKeyVal function.
//To test if a memory zone exists, use the MemExist function.

-Calling the MemKeyVal function
//The MemKeyVal function must only be called after the MemSeek, MemSetPosition, MemFirst, MemLast MemPrevious and MemNext functions.


MemLast

Use

//Points to the last element of a memory zone and returns the value of this element.

// Points to the last element of the memory zone
// "MyMemoryZone" and returns the value of this element
LastRes = MemLast("MyMemoryZone")

Syntax

<Result> = MemLast(<Memory zone name>)

-Parameters detail

<Result> // Any type
//If the memory zone is not empty : returned value of the last element, defined by the MemAdd or MemModify functions.
//If the memory zone is empty : an empty string (" ").

<Memory zone name> // Character string, name of the memory zone, defined by the MemCreate function.

Notes

-Sorting the memory zone
//Sort operations performed using the MemSort function apply when calling the MemLast function.
// If no sorting was performed by the MemSort function, the MemLast function returns the value of the last element added using the MemAdd function.

-Existence of the memory zone
//The existence of the memory zone is not checked.
//If the memory zone <Memory zone name> doesn't exist, a W-Language error is generated while executing the MemLast function.
//To test if a memory zone exists, use the MemExist function.

-Equivalence
//The following two syntax are equivalent :
Res = MemLast(<Memory zone name>)
Res = MemRetrieve(<Memory zone name>,MemCount(<Memory zone name>))


MemModify

MemModifiy

Use

//Modifies an element in a memory zone.

// Reset to 0 all the values greater than 100
// in the memory zone "MyMemoryZone"
FOR Index= 1 TO MemCount("MyMemoryZone")
ValueRes = MemRetrieve("MyMemoryZone", Index)
IF ValueRes > 100 THEN MemModify("MyMemoryZone", 0, 0, Index)
END

Syntax

MemModify(<Memory zone name>, <Value modified>, <Value returned>, <Index>)

-Parameters detail

<Memory zone name> // Character string, name of the memory zone, defined by the MemCreate function.

<Value modified> // Character string, integer or real, value modified in the memory zone.
//This value corresponds to the sort argument used by the MemSort function.
//You can retrieve this value using the MemKeyVal function.

<Value returned> // Character string, value returned by the MemRetrieve or MemSetPosition functions.

<Index> // Integer, index of the row to modify.
//The index of an element can be obtained by using the MemCurrent or MemSeek functions.

Notes

-Existence of the memory zone
//The existence of the memory zone is not checked.
//If the memory zone <Memory zone name> doesn't exist, a W-Language error is generated while executing the MemModify function.
//To test if a memory zone exists, use the MemExist function.

-Sorting elements
//The element modified in the memory zone is not sorted.
//You must use the MemSort function to sort the entire memory zone.


MemNext

Use

//Points to the next element of a memory zone and returns the value of this element.

// Points to the next element of the memory zone
// "MyMemoryZone" and returns the value of this element
NextRes = MemNext("MyMemoryZone")

Syntax

<Result> = MemNext(<Memory zone name>)

-Parameters detail

<Result> // Any type
//If the previous element exists : returned value of the next element, defined by the MemAdd or MemModify functions.
//If the next element doesn't exist : an empty string (" ").

<Memory zone name> // Character string, name of the memory zone, defined by the MemCreate function.

Notes

-Sorting the memory zone
//Sort operations performed using the MemSort function apply when calling the MemNext function.
//If no sorting was requested, the MemNext function returns the value of the next element based on the order of the elements added using the MemAdd function.

-Existence of the memory zone
//The existence of the memory zone is not checked.
//If the memory zone <Memory zone name> doesn't exist, a W-Language error is generated while executing the MemNext function.
//To test if a memory zone exists, use the MemExist function.

-Seek operations in a memory zone
//If the MemSeek function is used before calling the MemNext function, the MemNext function will point to the previously sought element

-Equivalence
//The following two syntax are equivalent:
Res = MemNext(<Memory zone name>)
Res = MemRetrieve(<Memory zone name>,MemCurrent(<Memory zone name>)+1)


MemOut

Use

//Enables you to find out if the read operation performed on a memory zone is outside this memory zone.

MemFirst("MyMemoryZone")
// read operation outside the memory zone "MyMemoryZone" ?
WHILE MemOut("MyMemoryZone") = False
// Process in the memory zone
...
// End processes
MemNext("MyMemoryZone")
END

Syntax

<Result> = MemOut(<Memory zone name>)

-Parameters detail

<Result> // Boolean
True // if the end of the memory zone has been reached,
False // otherwise.

<Memory zone name> // Character string, name of the memory zone, defined by the MemCreate function.

Notes

-Calling the MemOut function
//The MemOut function must be used after calling the MemFirst, MemLast, MemNext, MemPrevious and MemSeek functions in order to test if the end of the memory zone has been reached.

-Existence of the memory zone
//The existence of the memory zone is not checked.
//If the memory zone <Memory zone name> doesn't exist, a W-Language error is generated while executing the MemOut function.
//To test if a memory zone exists, use the MemExist function.


MemPrevious

Use

//Points to the previous element of the current element of a memory zone and returns the value of this element.

// Points to the previous element of the memory zone
// "MyMemoryZone" and returns the value of this element
PreviousRes = MemPrevious("MyMemoryZone")

Syntax

<Result> = MemPrevious(<Memory zone name>)

-Parameters detail

<Result> // Any type
//If the previous element exists : returned value of the previous element, defined by the MemAdd or MemModify functions.
//If the previous element doesn't exist : an empty string (" ").

<Memory zone name> // Character string, name of the memory zone, defined by the MemCreate function.

Notes

-Sorting the memory zone
//Sort operations performed using the MemSort function apply when calling the MemPrevious function.
//If no sorting was requested, the MemPrevious function returns the value of the previous element based on the order of the elements added using the MemAdd function.

-Existence of the memory zone
//The existence of the memory zone is not checked.
//If the memory zone <Memory zone name> doesn't exist, a W-Language error is generated while executing the MemPrevious function.
//To test if a memory zone exists, use the MemExist function.

-Seek operations in a memory zone
//If the MemSeek function is used before calling the MemPrevious function, the MemPrevious function will point to the previously sought element

-Equivalence
//The following two syntax are equivalent :
Res = MemPrevious(<Memory zone name>)
Res = MemRetrieve(<Memory zone name>, MemCurrent(<Memory zone name>)-1)


MemRetrieve

Use

//Retrieves the value of an element in a memory zone.

// Retrieve the value of element 7
// found in the memory zone "MyMemoryZone"
RetrieveRes = MemRetrieve("MyMemoryZone", 7)

Syntax

<Result> = MemRetrieve(<Memory zone name>, <Index>)

-Parameters detail

<Result> // Character string, value returned by the specified element (defined by the MemAdd or MemModify functions) or an empty string (" ") if the specified element wasn't found.

<Memory zone name> // Character string, name of the memory zone, defined by the MemCreate function.

<Index> // Integer, index of the element to use.
//The index of an element can be obtained by using the MemCurrent or MemSeek functions.

Notes

-Existence of the memory zone
//The existence of the memory zone is not checked.
//If the memory zone <Memory zone name> doesn't exist, a W-Language error is generated while executing the MemRetrieve function.
//To test if a memory zone exists, use the MemExist function.

-Positioning in the memory zone
//The MemRetrieve function doesn't point to the element used.
//To point to the <Index> element, use the MemSetPosition function.


MemSeek

Use

//Seeks an element in a memory zone:

//either based on the value added using the MemAdd function or on the value modified by the MemModify function,

//or based on the value returned.

- Note :
//This search is an identical search.

// Finding the first value equal to "M" in the memory zone "MemZone"
SeekRes = MemSeek("MemZone", "M")

Syntax

<Result> = MemSeek(<Memory zone name>, <Value sought> [,<Element>])

-Parameters detail

<Result> // Any type
//If the <Element> parameter is set to True (by default) :
//Name of the first element found or a blank string (" ") if no element has been found.
//If the <Element> parameter is set to False :
//Name of the first element found or -1 if no element has been found.

<Memory zone name> // Character string, name of the memory zone, defined by the MemCreate function.

<Value sought> // Character string, value sought in the memory zone.

<Element> // Boolean
True // (default value) : the search is performed on the value added by the MemAdd function or on the value modified by the MemModify function.
False // the search is performed on the returned value.

Notes

-Browsing through a memory zone
//The MemSeek function lets you start browsing through the memory zone.
//After executing the MemSeek function:
//the MemNext function will point to the next element sought.
//the MemPrevious function will point to the previous element sought.
//To resume a regular browse, you must use the MemFirst or MemLast functions.

-Seeking a numeric value
//To seek a numeric value, convert this value into a string using the NumToString function before running the MemSeek function.

-Error
//A W-Language error is generated when executing the MemSeek function :
//if the memory zone <Memory zone name> doesn't exist.
//To test if a memory zone exists, use the MemExist function.

//if the memory zone <Memory zone name> hasn't been sorted first.
//To sort a memory zone, use the MemSort function.


MemSetPosition

Use

//Points to an element in the memory zone.

// Point to the 7th element in the memory zone "MyMemoryZone"
PositionRes = MemSetPosition("MyMemoryZone", 7)

Syntax

<Result> = MemSetPosition(<Memory zone name>, <Index>)

-Parameters detail

<Result> // Character string, returned value of the specified element, defined by the MemAdd or MemModify functions.

<Memory zone name> // Character string, name of the memory zone, defined by the MemCreate function.

<Index> // Integer, index of the element to which the memory zone must point.
//The index of an element can be obtained by using the MemCurrent or MemSeek functions.

Notes

-Existence of the memory zone
//The existence of the memory zone is not checked.
//If the memory zone <Memory zone name> doesn't exist, a W-Language error is generated while executing the MemSetPosition function.
//To test if a memory zone exists, use the MemExist function.


MemSort

Use

//Sorts the elements found in a memory zone. This sort is performed on the sort argument specified with the MemAdd or MemModify functions.

// Ascending sort of the elements of the "MemoryZone" memory zone
MemSort("MemoryZone", True)

Syntax

MemSort(<Memory zone name> [, <Direction>])

-Parameters detail

<Memory zone name> // Character string, name of the memory zone, defined by the MemCreate function.

<Direction> // Optional boolean
True //(default value) if the sort order must be ascending,
False // if the sort order must be descending.

Notes

-Existence of the memory zone
//The existence of the memory zone is not checked.
//If the memory zone <Memory zone name> doesn't exist, a W-Language error is generated while executing the MemSort function.
//To test if a memory zone exists, use the MemExist function.

-Sorting elements
//The sort is used by the read functions MemFirst, MemLast, MemNext and MemPrevious, as well as by the MemSeek function.


Message
Saisissez ici le texte de la page


Middle

Use

//Extracts a sub-string from a given position in a string.

Middle("Eponine", 2, 3) // Returns "pon"
Middle("Eponine", 2) // Returns "ponine"
Middle("Eponine", 50) // Returns ""
Middle("Eponine", 2, 50) // Returns "ponine"

Syntax

<Result> = Middle(<Source string>, <Starting Position> [, <Length>])

-Parameters detail

<Result> // Character string
//Part of <Source string>.
//Empty string ("") if the parameter <Starting position> is greater than the length of <Source string>.
EOT // if the <Length> parameter is negative. A W-Language error occurs (non fatal error).

<Source string> // Character string, character string containing the sub-string to extract.
//This string is not truncated.

<Starting Position> // Integer, position of the first character to extract.
//If <Starting position> is negative or null, the extraction starts at the beginning of the string.

<Length> // Optional integer, number of characters to extract.
//If this parameter is not specified or is greater than the number of characters remaining after the <Starting position>, the string is returned starting from the <starting position>.

Notes

-Miscellaneous
//The first character of the string has the index 1.
//You can obtain the same result using the [[ ]] operator.


Min

Use

//Returns the smallest of the values passed as parameters.

// Largest value?
MinRes = Min(10, 15, 20) // Returns 10
MinRes = Min("Z", "A") // Returns "Z"

Syntax

<Result> = Min(<Value 1>, <Value 2> [, <Value N>])

-Parameters detail

<Result> // Character string, integer or real, the smallest of the values passed as parameters.

<Value 1>/<Value 2>/<Value N> // Character string, integer or real, value to compare.


Modulo

Use

//Returns the remainder after an integer division.

// Recovering division remainder
DivisionRemainder = Modulo(21,4) // DivisionRemainder is 1
// Equivalent to: DivisionRemainder = 21 Modulo 4

Syntax

-Modulo Function

<Division remainder> = Modulo(<Dividend>,<Divisor>)

-Parameter details

<Division remainder> // Integer, remainder of the integer division

<Dividend> // Integer, fivision dividend.

<Divisor> // Integer, division divisor.
//If this parameter is set to zero, the W-Language will generate an error.

-Modulo Keyword

<Division remainder> = <Dividend> Modulo <Divisor>

-Parameter details

<Division remainder> // Integer, remainder of the integer division

<Dividend> // Integer, division dividend.

<Divisor> // Integer, division divisor.
// If this parameter is set to zero, the W-Language will generate an error.


Mvalue

Mvalue (TRUE function)

Use

//Return the value of a mirror stock.
//The operation is the same as the function Svalue("a"), except about the time parameter.

-Mirror stock values :
//When calling the function Mvalue(), parameter time t is automatically set to t - 1.
//Indeed, a mirror stock represents the sum of the values of its sources stocks.
//This sum is calculated after all running procedure actions.
//It is thus impossible to obtain, in an action, the current mirror stock value.
//It's why the previous value must be evaluated.
//If c = 1 and t = 1, the function returns the sum of the values of the initial values of the sources stocks of the concerned mirror stock.
//If cycle > 1 and t = 1, the value corresponding to the last time unit of the previous cycle is returned.
//A message reminds that when inserting this function.

//This information is displayed, when inserting, by drag and drop or double click, the Mvalue() function, for a mirror stock :

Notes :
// to not display this message, enable switch "don't remember me this information".

-Example 1

//y is the return value of the procedure
y = Mvalue("m")
//y = value of the mirror stock for current cycle c and time t = t-1

-Example 2

//y is the return value of the procedure
//c is the current cycle
//t is the current time unit
c_, t_ are int
c_= 4; t_= 10
IF c_ <= c AND t_ <= t THEN y = Mvalue("b",c_,t_)
//y = value of the mirror stock b for cycle c_=4 and time t_= 10 - 1

-Example 3

//y is the return value of the procedure
//nbt is the current number of time, cumulated for all cycles
nbt_ is int
nbt_= nbt-10
IF nbt_ > 0 THEN y = Mvalue("b",Faux,nbt_)
//y = value of the mirror stock b for the time nbt - (10 -1)

First Syntax

Mvalue(<Mirror stock name>,[<Cycle>,<Time>] )

-Parameter details

<Mirror stock name> // Character string, is the stock name which value must be obtained.
<Cycle> // Optional integer, is cycle for which the value must be obtained.
<Time> // Optional integer, is time unit - 1 for which the value must be obtained.
// If parameters <Cycle> and <Time>, do not correspond to a valid value, the function will return 0.

Second Syntax

Mvalue(<Mirror stock name >,[<False>,<Number of time>] )

-Parameter details

<Mirror stock name> // Character string, is the stock name which value must be obtained.
<False> // Optional boolean, replaces the <C, and indicates that the parameter <Number of time>, must correspond to the variable nbt, which represents the number of time for all cycles.
<Number of time> // Optional integer, which is equal to the number of time - 1 for all cycles.
// If parameters <Number of time>, doesn't correspond to a valid value, the function will return 0.


NoAccent

Use

//Transforms the accented characters of a character string into non accented characters.

NoAccent("pépère") // Returns "pepere"
NoAccent("où ça ?") // Returns "ou ça ?"
NoAccent("") // Returns ""

Syntax

<Result> = NoAccent(<Initial string>)

-Parameters detail

<Result> // Character string, character string in which all the accented characters have been replaced by non accented characters.

<Initial string> // Character string, initial character string.


NoSpace

Use

//Returns a character string without spaces on the right or on the left.

NoSpace(" 3.75 FF ") // Returns "3.75 FF"

Syntax

<Result> = NoSpace(<Initial string>)

-Parameters detail

<Result> // Character string, character string without spaces.

<Initial string> // Character string, initial character string which spaces on the right and on the left must be deleted.
//This character string is not truncated.


NumToString

Use

//Transforms a numeric (integer, real or currency) into a character string of the specified format.

NumToString(123) // Returns "123"
NumToString(1.23) // Returns "1.23"
NumToString(12345.5, "+10.2f") // Returns " +12345.50"
NumToString(12345.5, "-+10.2f") // Returns "+12345.50 "
NumToString(12345.5, "+010.2f") // Returns "+012345.50"
NumToString(12345.5, "010.2f") // Returns "0012345.50"

NumToString(12345.5, "10.2fS")
// Returns " 12 345.50" (the thousands separator is " ")

NumToString(12345.5, "10,2fS")
// Returns " 12 345,50" (the decimal separator is ",")

Syntax

<Result> = NumToString(<Number> [, <Format>])

-Parameters detail

<Result> // Character string, number expressed as a character string based on the chosen format.
//If the <Number> parameter is a string, it is returned as is. The format is ignored.

<Number> // Integer or real, numeric to convert into a character string (based on the specified format).

<Format> // Character string, format of the character string, expressed as :

"[<Alignment>][<Sign>][<Zero>][<Size>][<.Precision>] <Type>[<Thousand>]"

<Alignment> //If this parameter is specified, align the number to the left (<Alignment>= "-").
//By default, the number is aligned to the right.

<Sign> //If this parameter is specified, forces the sign for the positive numbers (<Sign> = "+").
//This sign will appear to the left of the first significant number.
//By default, only the negative numbers have a "-" sign to the left of the first significant number.
//Special cases: if this parameter is specified and if the number is 0, the "+" sign is displayed.
//Same if a negative number becomes equal to 0.

<Zero> //If this parameter is specified (<Zero>="0"), the number will be completed by zeros
//to the left of the first significant number if the significant part of the number is smaller
//than the size requested and if the number is right justified.
//By default, the number is not completed to the left by "0".
//For example :
NumToString(123,"05d") // will result in "00123".

<Size> //Fix the total length of the resulting string.
//The total length correspond to the following elements : sign, thousand separator, decimal point, exponent, integer and decimal parts of the number.
//This size must be smaller than 100.
//If the specified size is too small to contain the significant part it will be ignored.
//By default, the number will have the size of its significant part (it cannot be completed by zeros). Idem if <Size> = 0
//If the specified size is larger than the number's significant part :
//- the resulting string will be completed by spaces to the right if the number is left justified,
//- the resulting string will be completed by spaces or zeros to the left if the number is right justified.

<Precision> //Fixes the decimal separator (only for float <Types> ("f") and exponent ("e").
//The number of decimal must be lower than 100.
//If the number of decimals of the number is greater than <Precision>, the decimal part is rounded to the number of decimals specified.
//If the number of decimal of the number is smaller than <Precision>, the decimal part will be completed by ")" to the right.
//If the decimal separator is a comma, the decimal separator will be the one defined in the Windows configuration.
//The value of <Precision> can be larger than <Size>. In this case <Size> is ignored.

<Type> //Type of the result, required parameter :
d // Integer : a real number is rounded to the nearest integer.
e // Exponential notation : If <Precision> is not indicated, 6 digits by default.
f // Decimal notation : If <Precision> is not indicated, 6 digits by default.
x and X // Hexadecimal notation (X for uppercase letters) :
//Only the decimal part of the number is taken into account (no rounding).
//Special cases :
//1. Size not specified and negative number : 20 hexadecimal characters for a currency, 8 characters for all the other numeric types.
//2. Negative number: the size of the resulting string will be at least the size allowing to specify the sign bit.
//For example : -32767 in the format "3X" will result in "8001"
o // Octal notation :
//Only the decimal part of the number is taken into account (no rounding).
//Special cases:
//1. Size not specified and negative number: 27 hexadecimal characters for a currency, 11 characters for all the other numeric types.
//2. Negative number: the size of the resulting string will be at least the size allowing to specify the sign bit.
//For example : -32767 in the format "3o" will result in "700001"

<Thousand> //Thousands separator (<Thousand> = "S" or "s").
//The digits of the integer part of the number will be grouped by 3 and separated by the thousand separator character defined in MS Windows.
//If the sign is present, it will always be immediately to the left of the first significant number.
//There cannot be a thousand separator between the sign and the first number.

Notes

-Restrictions
//Format "f" returns a valid result for numbers from -1e+17 to 1e+17.
//Formats "x", "d" or "o" : the integer part shouldn't be more than 99 999 999 999 999 999.


Options

Options (TRUE function)

Use

//Initialize one or more functionalities, executed at the end of the procedure.

-Example 1

//y is the return value of the procedure
IF y=50 THEN Options(3)

-Example 2

//y is the return value of the procedure
IF y=50 THEN Options(3,5,6,7)

First Syntax

Options(<Option number>,[<Option number>,<Option number>,…..] )

-Parameter details

<Option number> // integer, number of the option to be executed.
//Seven options can't be simultaneously defined.

1 // Show link as active even if return value = 0 :
//By default, when the transfer value of the actions of a link is null, this link is displayed in inactive state.
//To display the link in active state, even if the transfer value is null, initialize this option.

2 // Don't show link referenced to objects :
//By default, if an action refers to an object value using functions Ovalue() or Mvalue(), a reference link is displayed.
//To not display this link, initialize this option.

3 // Don't show link referenced to links :
//By default, if an action refers to a link value using function Lvalue(),a reference link is displayed.
//To not display this link, initialize this option.

4 // Disable action for current default cycle :
//The procedure of this action will no more run until the end of the current default cycle.

5 // Disable action for current floating cycle, if initialized :
//The procedure of this action will no more run until the end of the current float cycle, if the type of cycle is float default or float float.

6 // Disable action for all cycles :
//The procedure of this action will never run, for current cycle and all the cycles to come.

7 // Stop compute at the end of the cycle :
//Computing will automatically stop at the end of the current default cycle.


Svalue

Ovalue (TRUE function)

Use

//Return the value of an object of the elaboration.

-Example 1

//y is the return value of the procedure
y = Ovalue("b")
//y = value of the object b pour current cycle c and current time t

-Example 2

//y is the return value of the procedure
//c is the current cycle
//t is current time unit
c_, t_ are int
c_= 4; t_= 10
IF c_ <= c AND t_ <= t THEN y = Ovalue("b",c_,t_)
//y = value of the object b for cycle c_=4 and time t_ = 10

-Example 3

//y is the return value of the procedure
//nbt is the current number of time, for all cycles
nbt_ is int
nbt_= nbt-10
IF nbt_ > 0 THEN y = Ovalue("b",False,nbt_)
//y = value of the object b for time nbt - 10

First Syntax

Ovalue(<Object name>,[<Cycle>,<Time>] )

-Parameter details

<Object name> // Character string, is the object name which value must be obtained.
<Cycle> // Optional integer, is cycle for which the value must be obtained.
<Time> // Optional integer, is time unit for which the value must be obtained.
//If parameters <Cycle> and <Time>, do not correspond to a valid value, the function will return 0.

Second Syntax

Ovalue(<Object name>,[<False>,<Number of time>] )

-Parameter details

<Object name> // Character string, is the object name which value must be obtained.
<False> // Optional boolean, replaces <Cycle> parameter, and indicates that the parameter <Number of time>, must correspond to the variable nbt, which represents the number of time for all cycles.
<Number of time> // Optional integer, which is equal to the number of time for all cycles.
//If parameters <Number of time>, doesn't correspond to a valid value, the function will return 0.


Phonetic

Use

//Returns the phonetic value corresponding to the string passed as a parameter.
//You can detect if two character strings are phonetically similar (based on French phonetics).

// Comparing two character strings
Phonetic("TRAIT") = Phonetic("très")

Syntax

<Result> = Phonetic(<Source string>)

-Parameters detail

<Result> // Character string, character string in pseudo-phonetic corresponding to <Source string>.

<Source string> // Character string, character string to translate phonetically. This string is not modified.


Position

Use

//Searches for the position of a character string inside another character string.

n = Position("They all have rounded hats", "all") // returns 6
n = Position("They all have rounded hats", "XXX") // Returns 0
n = Position("They all have rounded hats", "l") // Returns 7
n = Position("They all have rounded hats", "e", 11) // Returns 13

Syntax

<Result> = Position(<Initial string>, <string sought> [, <Starting Position> [,<Option>]])

-Parameters detail

<Result> // Integer, position of the first character of the sought string in the initial string, or 0 if the sought string is not found.

<Initial string> // Character string, character string in which the search must be performed (Maximum size: 2 GB).

<string sought> // Character string, character string to be searched for in the initial string.

<Starting Position> // Optional integer, index of the character from which the research must be performed.
//By default, the search starts from the first character (character 1).
//If this parameter is negative, the search starts from the first character.
//If this parameter is greater than the number of character of the <Initial string>, <Result> is equal to 0.

<Option> // Constant (or combination of constants), optional, indicates the direction of the search and the characteristics of the search :
FromBeginning //(by default), search performed from the first character of the string to the last one.
FromEnd //Search performed from the last character of the string to the first one.
WholeWord //Search whole word only, meaning in-between punctuation characters or spaces.
IgnoreCase //Search without taking the character's case (uppercase/lowercase) into account

Notes

-Searching for the character string
//By default, the search is case sensitive :
//the string sought must have the same case as the string to find in the string.
//To perform a non case sensitive search, use the IgnoreCase parameter.

//Positions in a character string are always given from the beginning of the string, regardless of the direction of the search.

//To use the function Position with the parameter FromEnd, you must start from the position calculated by Lenght(<Initial string>).
//For example :
Position(MyString, "\", Lenght(MyString), FromEnd)

//The following syntax can also be used. In this case, the 0 parameter enable the function to select the best starting position.
Position(MyString, "\", 0, FromEnd)

-Mi
//The PositionOccurrence function lets you find out the position of the Nth occurrence of a sub-string by performing a search either from the beginning of the string, or from the end of the string.


PositionOccurrence

Use

//Searches for the Xth position of a character string inside another character string.

n = PositionOccurrence("An example string", "s",1) // Returns 12
n = PositionOccurrence("An example string", "zen",1) // Returns 0
n = PositionOccurrence("An example string", "e",1) // Returns 4
n = PositionOccurrence("An example string", "e", 2) // Returns 10

// Searching for the first "m" from the end:
// the position is given from the beginning
n = PositionOccurrence("An example string", "m", 1, FromEnd)
// Returns 7

Syntax

<Result> = PositionOccurrence(<Initial string>, <string sought> , <Rank of the occurrence sought> [<Search option>])

-Parameters detail

<Result> // Integer, position of the first character of the occurrence sought in the initial string, or 0 if the sought string is not fond.

<Initial string> // Character string, character string in which the search must be performed (Maximum size: 2 GB).

<string sought> // Character string, character string to be searched for in the initial string.

<Rank of the occurrence sought> // Integer, number of the occurrence of the <String sought>.
//<Result> will contain the position of this occurrence.
//If this parameter is smaller than 1, <Result> is 0.
//If this parameter is greater than the number of characters of the <Initial string>, <Result> is equal to 0..

<Search Options> // Optional constant, indicates the direction and the search options :
FromBeginning //(by default), search performed from the first character of the string to the last one.
FromEnd //Search performed from the last character of the string to the first one.
WholeWord //Search a whole word (surrounded by punctuation characters or spaces)
IgnoreCase //Search without taking the character's case (uppercase/lowercase) into account

Notes

-Searching for the character string
//By default, the search is case sensitive : the string sought must have the same case as the string to find in the string.
//To perform a non case sensitive search, use the IgnoreCase constant.


Power

Use

//Raises a number to a power.

// 8 to the power of 5
PowerRes = Power(8,5)
// Returns 32768

Syntax

<Result> = Power(<Number to raise to the Power>, <Exponent>)

-Parameters detail

<Result> // Real, result of the <Number> to the power of <Exponent>.

<Number> // Integer or real, number to raise to the power.

<Exponent> // Integer or real, exponent.


Random

Use

//Returns a random number.

// Retrieving a real number between 0 and 1
RandomRes = Random()
// Retrieving an integer found between 1 and 33
RandomRes = Random(33)
// Retrieving an integer found between 1 and 33
RandomRes = Random(7, 21)

Syntax

-Retrieving a random number found between 0 and 1
<Result> = Random()

-Parameter detail
<Result> // Real, random number found between 0 and 1.

-Retrieving a random number found between 1 and a value
<Result> = Random(<Maximum limit>)

-Parameters detail
<Result> // Integer, random number found between 1 and a value
<Maximum limit> // Integer, maximum value of the number returned (value between 1 and 2,147,483,647).

-Retrieving a random number found between two values
<Result> = Random(<Minimum limit>, <Minimum limit>)

-Parameters detail
<Result> // Integer, random number found between two specified values.
<Minimum limit> // Integer, minimum value of the number returned (value between 0 and 2,147,483,647).
<Maximum limit> // Integer, maximum value of the number returned (value between 0 and 2,147,483,647).

Notes

-Random spool
//The "pool" from which the random number is "chosen" can be initialized by the InitRandom function.
//If the InitRandom function isn't called, the random values generated by the Random function will be the same every time the program is run.


RepeatString

Use

//Concatenates N repetitions of the same character string.

Res = RepeatString("x", 4) // Returns "xxxx"
Res = RepeatString("Boby", 2) // Returns "BobyBoby"
Res = RepeatString("", 2) // Returns ""
Res = RepeatString("", 0) // Returns 0

Syntax

<Result> = RepeatString(<Initial string>, <Number of repetitions>)

-Parameters detail

<Result> // Character string, new character string containing the repetitions requested or an empty string ("") if <Number of repetitions> is negative or null.

<Initial string> // Character string, character string to repeat.

<Number of repetitions> // Integer, number of times the <Initial string> must be repeated.


Replace

Use

//Replaces all the occurrences of a word found in a string by another word.

-Note :
//The initial character string is not modified.

InitialString is string = "Abracacabra !"
ReplacedString is string = Replace(InitialString,"a","o")
Info(ReplacedString) // Displays "Abrococobro !"

Syntax

<Result> = Replace(<Initial string>, <string sought>, <new string> [,<Option>])

-Parameters detail

<Result> // Character string, new character string in which the different replacements have been performed.

<Initial string> // Character string, character string in which the replacement must be performed (maximum size: 2 GB).

<string TO Replace> // Character string, character string to be replaced in the initial string.
//If this parameter corresponds to an empty string (""), <Result> will be the <Initial string>.

<new string> // Character string, character string that will replace <String to replace>.
//If this parameter corresponds to an empty string (""), all the occurrences of <String to replace> will be deleted.

<Option> // Constant (or combination of constants), optional
//Indicates the search characteristics of the word to replace :
WholeWord //Search a whole word (surrounded by punctuation characters or spaces)
IgnoreCase //Search without taking the character's case (uppercase/lowercase) into account

Notes

-Searching for the character string
//By default, the search is case sensitive :
//the string sought must have the same case as the string to find in the initial string.
//To perform a non case sensitive search, use the IgnoreCase constant.


ReStartAt

Example

Use

//The function allows to restart computing at a given unit time.

//An action which wants to make a retro-computing, must open a gate towards the past.

//The fonction ReStartAt() allows the retro-computing. She returns the number of the opened gate.
//The number of the gate is associated to the current action and the current "number of time " (nbt).

//There cannot be more than one gate for the same action and the same nbt.

//To this gate is associated a counter of passing, by this one.
//This counter is incremented when passing by the gate towards the past.

//The status of the gates of the elaboration can be retrieve by ReStartStat() function.

//Restart computing at unit time 10 of cycle 2
ReStartAt ( 2, 10)

First Syntax

<Result>=ReStartAt(<Cycle>,<Unit time>,[<max_passing>],[<max_action_gate>],[<max_link_gate>],
[<max_global_gate>])

-Parameter details

<Result> // number of the created gate, or already created gate, by the action, for the current "number of time" (nbt).
//If the gate already exists, passing counter is incremended.

<Cycle> // Integer which indicates for which cycle one wants to start retro-computing.

<Unit time> // Integer which indicates for which unit time one wants to start retro-computing.
//If parameters <Cycle> and <Unit time> do not correspond to a valid unit time, function returns 0.
//This parameters must correspond to a present or past unit time.

<max_passing> // Optional integer which limits the number of passage by this gate.

<max_action_gate> // Optional integer which limits the number of gate which can be opened by the current action.
//Indeed other gates can be opened for other "numbers of time " (nbt), by the current action.

<max_link_gate> // Optional integer which limits the number of gate which can be opened by the current link.
//Indeed other gates can be opened for other "numbers of time " (nbt), by the link containing the current action.

<max_global_gate> // Optional integer which limits the number of gate which can be opened by all the actions of the elaboration.

Notes

//If one of the limits is reached, the gate is not created.
//If the gate already existed, it is deleted, and the passage towards the past is not done.

Second Syntax

<Result>=ReStartAt(<False>,<Number of time>,[<max_passing>],[<max_action_gate>],
[<max_link_gate>],[<max_global_gate>])

-Parameter details

<False> // boolean, replaces the <Cycle> parameter, and indicates that the parameter <Number of time>,
//must correspond to the variable represent the number of time for all cycles.

<Number of time> // integer, which indicates for which "number of time" one wants to start retro-computing.
//If parameter <Number of time>, doesn't correspond to a valid value, the function will return 0.

Notes

//See previous syntax the the other parameters.

//Below, graph of the y values for the procedure containing the ReStart() function :

X

Notes

//The graph caption " G.p 1.2 " means "Gate 1, passing 2".


ReStartStat

Example

Use

//The ReStartStat() function return the status of the gates created by the ReStartAt() function.

//She initializes the global structure g which is accessible in the procedure from the current action.
//She can also return the current number of passage for a specified gate..

First Syntax

ReStartStat()

//Global structure g is initialised by the ReStartStat() function.
//The members of this structure are :

g:action_gate // number of the gate opened by the current action and the current nbt, if existing.
g:action_passing // number of passing for the gate opened by the current action for the current nbt, if existing.

g:nb_action_gate // number of gate opened by the current action.
g:nb_link_gate // number of gate opened by the current link.
g:nb_global_gate // number of gate opened by the elaboration.

g:global_passing // last number of passing for the last gate of the elaboration.

g:f_action_gate // boolean, true if a gate were opened by the current action for the current nbt.
g:f_link_gate // boolean, true if a gate were opened by the current link for the current nbt.
g:f_global_gate // boolean, true if a gate were opened by the elaboaration for the current nbt.

g:t_action_gate // array of the numbers of the gates opened by the current action.
g:t_link_gate // array of the numbers of the gates opened by the current link.

Notes :

// The dimension of the arrays g:t_action_gate and g:t_link_gate
// can be returned by the Dimension() function of the du W-Language.

Second Syntax

<Result>=ReStartStat(<Gate number>)

-Parameter Details

<Result> // Integer which contains the passing number of the gate <Gate number>.
// If the gate doesn't exist, the function return 0.

<Gate number> // Integer which contains the gate which one wants to obtain the passing number.


Reverse

Use

//Returns for each character of a string the complement to 255.
//The character string is reversed.

Res is string
Res = Reverse(TabName[Ind])

Syntax

<Result> = Reverse(<Source string>)

-Parameters detail

<Result> // Character string, contains the reversed character string.

<Source string> // Character string, character string to reverse.
// This string is not truncated.


Right

Use

//Extracts the right part of a character string (i.e. the last characters).

Right("The dog", 3) // Returns "dog"
Right("ABC", 50) // Returns "ABC"
Right(" AZELMA") // Returns "AZELMA"

Syntax

<Result> = Right(<Source string> [, <Length>])

-Parameters detail

<Result> // Character string
//Specified right part of <Source string>.
//Corresponds to <Source string> if the <Length> parameter is greater than the size of <Source string>.
EOT // if the <Length> parameter is negative. A W-Language error occurs (non fatal error).

<Source string> // Character string, character string which right part must be extracted.
//This string is not truncated.

<Length> // Optional integer , number of characters to extract.
//If this parameter is not specified, <Result> corresponds to <Source string> without the spaces on the left.


Root

Use

//Calculates the root of a number.

// Square root of 25
RootRes = Root(25)
// Returns 5

Syntax

<Result> = Root(<Number> [,<Root factor>])

-Parameters detail

<Result> // Real, root of the number.

<Number> // Integer or real, number to use.

<Root factor> // Integer or real, root factor.
//If this parameter is not specified, the square root of the <Number> is extracted.


Round

Use

//Returns the rounded value of a numeric value based on the number of decimal places specified.

// Retrieve the rounded value of -16.238167
RounRes = Round(-16.238167,2)
// Returns 16.24

Syntax

<Result> = Round(<Numeric value> [, <Number of decimal places>])

-Parameters detail

<Result> // Integer or real, rounded value of the specified numeric value.

<Numeric Value> // Real or currency, numeric value to round.
//We recommend that you use the currency type in order to get reliable results.

<Number of decimal places> // Optional integer,
//number of decimal places to return If this parameter is not specified, no decimal is returned.

Notes

-Numeric Value
//If <Numeric value> is found between :
//0 et 0.49: the number is rounded to 0. For example, 3.2 is rounded to 3 (no decimal).
//0.5 and 0.99: the number is rounded to 1. For example, 3.7 is rounded to 4 (no decimal).

-Decimal separator
//The decimal separator for real numbers is "." (point).


ZReStartAt

Use example for the ReStartAt function

-The action "Act" calls the ReStartAt() function for the nbt 50

//The futur gate number returned by the function is 1.
//The gate 1 will be created after exiting the action,
//and the first passage by this action will be set to 1.
//Retro-computing will be done for the temporal parameters c and t
//passed to the function, ReStartAt(c,t).
//When the action "Act" comes back to nbt 50 and she recalls the
//ReStartAt() function, return toward the past will be done through the
//previous created gate, the passing counter will be incremented and
//will be se to 2.
//If the action "Act" , at nbt 50, doesn't recall the ReStartAt()
//function, the gate 1 will be deleted, with the passing counter.

//y is the return value of the procedure
//c is the current cycle
//t is the current unit time
gate is int
c_, t_ are int

IF c = 5 AND t = 10 //nbt = 50
IF y <> <Waited Result>
c_ = 2 ; t_ = 5
gate = ReStartAt(c_,t_)
//computing will be restarted at time unit 5 of the cycle 2,
//after exiting the current action
END
END

-Opening a gate towards the past when a gate is already opened
//The action "Act" has opened the gate 1 and has done 3 passages
//by this gate.
//The action is coming back towards gate 1, but before reach this
//last one, she opens a new gate.
//The number of the new gate will be 2, and the associated passing
//counter will be 1.
//It is the same way when opening new gates by other actions.

//y is the return value of the procedure
//nbt is the current number of unit time, for all cycles

nbt_ is int
gate is int

IF nbt = 30
IF y <> <Waited Result>
nbt_ = 20
gate = ReStartAt(False,nbt_)
END
END


ZReStartStat

Use example for the ReStartStat function

-One wants to know the status of the gates of the elaboration

passing is int

ReStartStat()

y= g:global_passing
// one recovers the current number of passage for the last opened gate by the elaboration

IF y<>0
<Action>// if a passing exists, one starts an action

// one recovers the number of gate for the current action
y = Dimension(g:t_action_gate)

// one recovers the number of passage for gate number 3
IF y<=3
passing=g:t_action_gate[3]
END

END

-One wants to know the number of passage of one gate

gate,passing is int
gate = 3

// one recovers the number of passage for gate number 3
passing = ReStartStat(gate)

// one starts actions according to the current number of passage
SWITCH passing
CASE 1 : <Action 1 >
CASE 2 : <Action 2 >
END


Nouvelle page
Saisissez ici le texte de la page


Sin

Use

//Calculates an angle's sine.

// Sine of 30
SineRes = Sine(30)
// Returns 0.5

Syntax

<Result> = Sin(<Angle>)

-Parameters detail

<Result> // Real, sine of the specified angle.

<Angle> // Integer or real, angle (in degrees) to manipulate.


Sound

Use

//Plays a sound in WAV format This sound can be :
//stored on the disk
//integrated in the library (.WDL)
//present in a Hyper File memo

-Note :
//A sound card must be installed on the station.
//The sound will be played according to the Windows parameters (volume, balance, etc.)

// Play the sound found in the "TADA.WAV" file
Sound("Tada.wav")

// Play locking sound on sound card
Sound("tada.wav", soundWait)

// Play looping sound on sound card
Sound("C:\MSOFFICE\Sound\Car.wav", soundLoop + 1)

Syntax

Sound(<Name of .WAV file> [,<Option>])

-Parameters detail

<Name of .WAV file> // Character string, full or relative name of the .WAV file to play.

<Option> // Optional integer type constant, sound execution mode :
soundWait //The source code continues to run once the sound has been played
soundLoop //Sound played in a loop
soundDefault //(by default), the source code continues to run as soon as the sound has started playing

Notes

-Stopping a non-locking sound
//A sound played in non-locking mode can be stopped by using the following line :
Sound("") //, called on an user action for example (click, control modification, etc.)

-Size of sound file
//Using large size WAV files can create several problems (not enough RAM to load the sound, system halt depending on the version of Windows, etc.)
//With large .WAV files (several dozen megabytes), we recommend that you use the MCI functions.

-Locking sound
//A sound is always locking if :
//The sound is stored in a WinDev library (.WDL file).
//The sound comes from a binary memo.


StartTrace

Use

//Opens the Trace window.

-Notes :
//If the trace window is already opened, the StartTrace function has no action.

//The StartTrace function is optional.
//The first call to the Trace function automatically opens the trace window.

// Opens the Trace window on top of all the system windows
StartTrace(trTopMost)

Syntax

StartTrace([<Display mode>])

-Parameter detail

<Display mode> // Optional constant ,
trTopMost // if the trace window must be displayed on top of all the system windows.
//by default, this Trace window is opened in the Upper Left side of the screen.


SQLAssocie

StartTrace

Use

//Opens the Trace window.

-Notes :
//If the trace window is already opened, the StartTrace function has no action.

//The StartTrace function is optional.
//The first call to the Trace function automatically opens the trace window.

// Opens the Trace window on top of all the system windows
StartTrace(trTopMost)

Syntax

StartTrace([<Display mode>])

-Parameter detail

<Display mode> // Optional constant ,
trTopMost // if the trace window must be displayed on top of all the system windows.
//by default, this Trace window is opened in the Upper Left side of the screen.


SQLChangeConnection

Nouvelle page
Saisissez ici le texte de la page


SQLClose

Nouvelle page
Saisissez ici le texte de la page


SQLCol

Nouvelle page
Saisissez ici le texte de la page


SQLColumn

Nouvelle page
Saisissez ici le texte de la page


SQLColumnFormat

Nouvelle page
Saisissez ici le texte de la page


SQLConnect

Nouvelle page
Saisissez ici le texte de la page


SQLDisconnect

Nouvelle page
Saisissez ici le texte de la page


SQLExec

Nouvelle page
Saisissez ici le texte de la page


SQLFetch

Nouvelle page
Saisissez ici le texte de la page


SQLFirst

Nouvelle page
Saisissez ici le texte de la page


SQLGetCol

Nouvelle page
Saisissez ici le texte de la page


SQLGetMemo

Nouvelle page
Saisissez ici le texte de la page


SQLGetTextMemo

Nouvelle page
Saisissez ici le texte de la page


SQLInfo

Nouvelle page
Saisissez ici le texte de la page


SQLListSource

Nouvelle page
Saisissez ici le texte de la page


SQLListTable

Nouvelle page
Saisissez ici le texte de la page


StatAverage

Example

Use

//Calculate the arithmetic, geometric or harmonic mean of a series of values.

// Arithmetic mean of the elements in row 1 of a matrix
MeanRes = StatAverage("MyMatrix", statArithmetic, 1, False)

Syntax

<Result> = StatAverage(<Matrix name> [, <Mean type> [,<Row/column number> [, <Row/Column>]]])

-Parameters detail

<Result> // Real, series mean.

<Matrix name> // Character string, name of the matrix containing the data, defined using the MatCreate function.

<Mean type> // Optional constant, specifies the mean type to calculate :
statArithmetic //(by default), arithmetic mean
statGeometric //Geometric mean
statHarmonic //Harmonic mean

<Row/Column number> // Optional integer, number for the row or column containing the data (1 by default).

<Row/Column> // Optional boolean
True //(by default) if the series of values correspond to a matrix column,
False // if the series of values correspond to a matrix row.

Notes

-Number of elements in a matrix row or column
//The number of elements found in a matrix row or column is used as a reference.
//The number of elements correspond to :
//the total number of rows in the matrix, known by using MatNbLine (if the calculation is performed on a column);
//the total number of columns in the matrix, known by using MatNbRow (if the calculation is performed on a row);

//If the series have less elements than the matrix, the missing values are automatically completed by 0s.
//These values are taken into account during calculations.

-Error management
//Caution : The StatAverage function doesn't return any error code.
//To find out if this function has generated any error,
//use the StatError function.
//The text of the error message can be known by using the ErrorInfo function with the errMessage constant.


StatAverageDeviation

Example

Use

//Calculates the mean absolute deviations of the values in respect to the arithmetic mean.

-Note :
//The mean deviation represents how scattered a set of values is.

// Calculate the mean deviation of the elements in row 1 of a matrix
MeanDeviationRes = statAverageDeviation("MyMatrix", 1, False)

Syntax

<Result> = statAverageDeviation(<Matrix name> [,<Row/column number> [, <Row/Column>]])

-Parameters detail

<Result> // Real, mean deviation of the values or 0 if the mean deviation is null.

<Matrix name> // Character string, name of the matrix containing the data, defined using the MatCreate function.

<Row/Column number> // Optional integer, number for the row or column containing the data (1 by default).

<Row/Column> // Optional boolean
True //(by default) if the series of values correspond to a matrix column,
False // if the series of values correspond to a matrix row.

Notes

-Number of elements in a matrix row or column
//The number of elements found in a matrix row or column is used as a reference.
//The number of elements correspond to :
//the total number of rows in the matrix, known by using MatNbLine (if the calculation is performed on a column);
//the total number of columns in the matrix, known by using MatNbRow (if the calculation is performed on a row);

//If some series have less elements than the matrix, the missing values are automatically completed by 0s. These values are taken into account during calculations.

-Error management
//Caution : The statAverageDeviation function doesn't return any error code.
//To find out if the mean deviation calculation has generated any error, use the StatError function.
//The text of the error message can be known by using the ErrorInfo function with the errMessage constant.


StatCorrelation

Example

Use

//Calculates the correlation coefficient between two series of values.

// Calculate the correlation coefficient between row 1 and row 2 of a matrix
CorrelationCoefRes = StatCorrélation("MyMatrix", 1, 2, False)

Syntax

<Result> = StatCorrélation(<Matrix name> [, <First row/First column> [, <Second row/Second column> [, <Row/Column>]]])

-Parameters detail

<Result> // Real, correlation coefficient between two series of values or 0 if the correlation coefficient is null.

<Matrix name> // Character string, name of the matrix containing the data, defined using the MatCreate function.

<First row/First column> // Optional integer, first row or First column containing the data (1 by default).

<Second row/Second column> // Optional integer, second row or second column containing the data (2 by default).

<Row/Column> // Optional boolean
True //(by default) if the series of values correspond to a matrix columns,
False // if the series of values correspond to a matrix rows.

Notes

-Calculation of the correlation coefficient

StatCorrélation("MyMatrix", 1, 3, False) // returns 0,997054.

StatCorrélation("MyMatrix", 1, 3, False) // returns 1.

StatCorrélation("MyMatrix", 1, 3, False) // returns 0.

-Number of elements present in a matrix
//The number of elements present in the matrix is used as reference.
//The number of elements correspond to :
//the number of matrix rows, known by using MatNbLine ;
//the number of matrix column, known by using MatNbRow ;

//If some series have less elements than the matrix, the missing values are automatically completed by 0s.
//These values are taken into account during calculations.

-Error management
//Caution : The StatCorrelation function doesn't return an error code.
//To find out if the correlation coefficient calculation has generated any error,
//use the StatError function.
//The text of the error message can be known by using the ErrorInfo function with the errMessage constant.


StatCovariance

Example

Use

//Calculates the covariance between two series of values.

-Note :
//The covariance is the mean of the products of the deviations of each series.

// Calculate the covariance between row 1 and row 2 of a matrix
CovarianceRes = StatCovariance("MyMatrix", 1, 2, False)

Syntax

<Result> = StatCovariance(<Matrix name> [, <First row/First column> [, <Second row/Second column> [, <Row/Column>]]])

-Parameters detail

<Result> // Real, covariance between the two series or 0 if the covariance is null.

<Matrix name> // Character string, name of the matrix containing the data, defined using the MatCreate function.

<First row/First column> // Optional integer, first row or First column containing the data (1 by default).

<Second row/Second column> // Optional integer, second row or second column containing the data (2 by default).

<Row/Column> // Optional boolean
True // (by default) if the series of values correspond to a matrix columns,
False // if the series of values correspond to a matrix rows.

Notes

-Number of elements present in a matrix
//The number of elements present in the matrix is used as reference.
//The number of elements correspond to :
//the number of matrix rows, known by using MatNbLine ;
//the number of matrix column, known by using MatNbRow ;

//If some series have less elements than the matrix, the missing values are automatically completed by 0s.
//These values are taken into account during calculations.

-Error management
//Caution : The StatCovariance function doesn't return an error code.
//To find out if the covariance calculation has generated any error,
//use the StatError function.
//The text of the error message can be known by using the ErrorInfo function with the errMessage constant.


StatError

Example

Use

//Returns the number for the last error caused by a Statxxx function (statistical function).

// Identify the error type
ErrorRes = StatError()

Syntax

<Result> = StatError()

-Parameter detail

<Result> // Integer, returns the number for the last error caused by a statistical function :
//Number, Error type, Affected functions
0 //No error, All the functions
1 //Empty matrix, All the functions
2 //A minimum of two values is required in the matrix row or column, StatVariance, StatAverageDeviation
3 //Negative geometrical mean, StatAverage, StatStandardDeviation
4 //Division by zero, StatAverage, StatCorrelation
5 //The matrix doesn't exist, All the functions

Notes

-Text of the error.
//The text of the error message can be known by using the ErrorInfo function with the errMessage constant.


StatMax

Example

Use

//Calculates the maximum value of a series of values.

// Maximum value of the elements in row 1 of a matrix
MaxRes = StatMax("MyMatrix", 1, False)

Syntax

<Result> = StatMax(<Matrix name> [,<Row/column number> [, <Row/Column>]])

-Parameters detail

<Result> // Real, maximum value of the series.

<Matrix name> // Character string, name of the matrix containing the data, defined using the MatCreate function.

<Row/Column number> // Optional integer, number for the row or column containing the data (1 by default).

<Row/Column> // Optional boolean
True //(by default) if the series of values correspond to a matrix column,
False // if the series of values correspond to a matrix row.

Notes

-Number of elements in a matrix row or column
//The number of elements found in a matrix row or column is used as a reference.
//The number of elements correspond to :
//the total number of rows in the matrix, known by using MatNbLine (if the calculation is performed on a column) ;
//the total number of columns in the matrix, known by using MatNbRow (if the calculation is performed on a row) ;

//If the series have less elements than the matrix, the missing values are automatically completed by 0s.
//These values are taken into account during calculations.

-Error management
//Caution : The StatMax function doesn't return any error code.
//To find out if this function has generated any error,
//use the StatError function.
//The text of the error message can be known by using the ErrorInfo function with the errMessage constant.


StatMin

Example

Use

//Calculates the minimum value of a series of values.

// Minimum value of the elements in row 1 of a matrix
MinRes = StatMin("MyMatrix", 1, False)

Syntax

<Result> = StatMin(<Matrix name> [,<Row/column number> [, <Row/Column>]])

-Parameters detail

<Result> // Real, minimum value of the series.

<Matrix name> // Character string, name of the matrix containing the data, defined using the MatCreate function.

<Row/Column number> // Optional integer, number for the row or column containing the data (1 by default).

<Row/Column> // Optional boolean
True // (by default) if the series of values correspond to a matrix column,
False // if the series of values correspond to a matrix row.

Notes

-Number of elements in a matrix row or column
//The number of elements found in a matrix row or column is used as a reference.
//The number of elements correspond to :
//the total number of rows in the matrix, known by using MatNbLine (if the calculation is performed on a column) ;
//the total number of columns in the matrix, known by using MatNbRow (if the calculation is performed on a row) ;

//If the series have less elements than the matrix, the missing values are automatically completed by 0s.
//These values are taken into account during calculations.

-Error management
//Caution : The StatMin function doesn't return any error code.
//To find out if this function has generated any error,
//use the StatError function.
//The text of the error message can be known by using the ErrorInfo function with the errMessage constant.


StatStandardDeviation

Example

Use

//Calculates a series standard deviation.

-Reminder :
//The standard deviation measures how scattered values around the mean value.

-Note :
//This calculation is performed on a sample of values.
//To calculate the standard deviation of a complete series of values, use the StatStandardDeviationP function.

// Calculate the standard deviation of the elements in row 1 of a matrix
StandardDeviationRes = StatStandardDeviation("MyMatrix", 1, False)

Syntax

<Result> = StatStandardDeviation(<Matrix name> [,<Row/column number> [, <Row/Column>]])

-Parameters detail

<Result> // Real, standard deviation of the values or 0 if the mean deviation is null.

<Matrix name> // Character string, name of the matrix containing the data, defined using the MatCreate function.

<Row/Column number> // Optional integer, number for the row or column containing the data (1 by default).

<Row/Column> // Optional boolean
True // (by default) if the series of values correspond to a matrix column,
False // if the series of values correspond to a matrix row.

Notes

-Number of elements in a matrix row or column
//The number of elements found in a matrix row or column is used as a reference.
//The number of elements correspond to :
//the total number of rows in the matrix, known by using MatNbLine (if the calculation is performed on a column) ;
//the total number of columns in the matrix, known by using MatNbRow (if the calculation is performed on a row) ;

//If the series have less elements than the matrix, the missing values are automatically completed by 0s.
//These values are taken into account during calculations.

-Error management
//Caution : The StatStandardDeviation function doesn't return an error code.
//To find out if the standard deviation calculation has generated any error,
//use the StatError function.
//The text of the error message can be known by using the ErrorInfo function with the errMessage constant.


StatStandardDeviationP

Example

Use

//Calculates a complete series standard deviation

-Reminder :
//The standard deviation measures how scattered values are around the mean value.

-Note :
//The StatStandardDeviationP function uses the hypothesis that the arguments represent the entire population set.
//To calculate the standard deviation of a population sample, use the StatStandardDeviation function.
//With large size samples, the StatStandardDeviationP and StatStandardDeviation functions return roughly the same value.

// Calculate the standard deviation of the elements in row 1 of a matrix
StandardDeviationPRes = StatStandardDeviationP("MyMatrix", 1, False)

Syntax

<Result> = StatStandardDeviationP(<Matrix name> [,<Row/column number> [, <Row/Column>]])

-Parameters detail

<Result> // Real, standard deviation of the values or 0 if the mean deviation is null.

<Matrix name> // Character string, name of the matrix containing the data, defined using the MatCreate function.

<Row/Column number> // Optional integer, number for the row or column containing the data (1 by default).

<Row/Column> // Optional boolean
True // (by default) if the series of values correspond to a matrix column,
False // if the series of values correspond to a matrix row.

Notes

-Number of elements in a matrix row or column
//The number of elements found in a matrix row or column is used as a reference.
//The number of elements correspond to :
//the total number of rows in the matrix, known by using MatNbLine (if the calculation is performed on a column) ;
//the total number of columns in the matrix, known by using MatNbRow (if the calculation is performed on a row) ;

//If the series have less elements than the matrix, the missing values are automatically completed by 0s.
//These values are taken into account during calculations.

-Error management
//Caution : The StatStandardDeviationP function doesn't return any error code.
//To find out if the standard deviation calculation has generated any error,
//use the StatError function.
//The text of the error message can be known by using the ErrorInfo function with the errMessage constant.


StatSum

Example

Use

//Calculates the sum of a series of values.

// Sum of the elements in row 1 of a matrix
SumRes = StatSum("MyMatrix", 1, False)

Syntax

<Result> = StatSum(<Matrix name> [,<Row/column number> [, <Row/Column>]])

-Parameters detail

<Result> // Real, sum of the series values.

<Matrix name> // Character string, name of the matrix containing the data, defined using the MatCreate function.

<Row/Column number> // Optional integer, number for the row or column containing the data (1 by default).

<Row/Column> // Optional boolean
True // (by default) if the series of values correspond to a matrix column,
False // if the series of values correspond to a matrix row.

Notes

-Number of elements in a matrix row or column
//The number of elements found in a matrix row or column is used as a reference.
//The number of elements correspond to :
//the total number of rows in the matrix, known by using MatNbLine (if the calculation is performed on a column) ;
//the total number of columns in the matrix, known by using MatNbRow (if the calculation is performed on a row) ;

//If the series have less elements than the matrix, the missing values are automatically completed by 0s.
//These values are taken into account during calculations.

-Error management
//Caution : The StatSum function doesn't return any error code.
//To find out if this function has generated any error,
//use the StatError function.
//The text of the error message can be known by using the ErrorInfo function with the errMessage constant.


StatVariance

Example

Use

//Calculates the variance of a series of values.

-Note :
//This calculation is performed on a sample of values.
//To calculate the variance of a complete series of values, use the StatVarianceP function.

//Calculate the variance of elements in row 3
VarianceRes = StatVariance("MyMatrix", 3, False)

Syntax

<Result> = StatVariance(<Matrix name> [,<Row/column number> [, <Row/Column>]])

-Parameters detail

<Result> // Real, variance of a series of values.

<Matrix name> // Character string, name of the matrix containing the data, defined using the MatCreate function.

<Row/Column number> // Optional integer, number for the row or column containing the data (1 by default).

<Row/Column> // Optional boolean
True // (by default) if the series of values correspond to a matrix column,
False // if the series of values correspond to a matrix row.

Notes

-Number of elements in a matrix row or column
//The number of elements found in a matrix row or column is used as a reference.
//The number of elements correspond to :
//the total number of rows in the matrix, known by using MatNbLine (if the calculation is performed on a column) ;
//the total number of columns in the matrix, known by using MatNbRow (if the calculation is performed on a row) ;

//If the series have less elements than the matrix, the missing values are automatically completed by 0s.
//These values are taken into account during calculations.

-Error management
//Caution : The StatVariance function doesn't return an error code.
//To find out if the variance calculation has generated any error,
//use the StatError function.
//The text of the error message can be known by using the ErrorInfo function with the errMessage constant.


StatVarianceP

Example

Use

//Calculates the variance of a complete series of values.

-Note :
//The StatVarianceP function uses the hypothesis that the arguments represent the entire population set.
//To calculate the variance of a population sample, use the StatVariance function.
//With large size samples, the StatVarianceP and StatVariance functions return roughly the same value.

// Calculate the variance of elements in row 3
VariancePRes = StatVarianceP("MyMatrix", 3, False)

Syntax

<Result> = StatVarianceP(<Matrix name> [,<Row/column number> [, <Row/Column>]])

-Parameters detail

<Result> // Real, variance of a complete series of values.

<Matrix name> // Character string, name of the matrix containing the data, defined using the MatCreate function.

<Row/Column number> // Optional integer, number for the row or column containing the data (1 by default).

<Row/Column> // Optional boolean
True // (by default) if the series of values correspond to a matrix column,
False //if the series of values correspond to a matrix row.

Notes

-Number of elements in a matrix row or column
//The number of elements found in a matrix row or column is used as a reference.
//The number of elements correspond to :
//the total number of rows in the matrix, known by using MatNbLine (if the calculation is performed on a column) ;
//the total number of columns in the matrix, known by using MatNbRow (if the calculation is performed on a row) ;

//If the series have less elements than the matrix, the missing values are automatically completed by 0s.
//These values are taken into account during calculations.

-Error management
//Caution : The StatVarianceP function doesn't return an error code.
//To find out if the variance calculation has generated any error,
//use the StatError function.
//The text of the error message can be known by using the ErrorInfo function with the errMessage constant.


StringBuild

Use

//Builds a character string based on a format and some parameters.

MyString1 is a string
MyString1 = "The file %1 cannot be opened by" + ...
"the user %2. File %1 is not accessible."
Result is string = StringBuild(MyString1, "Example", "Tintin")

Syntax

<Result> = StringBuild(<Format> [, <First Parameter> [, <Second Parameter> [, ...]]])

-Parameters detail

<Result> // Character string, string result : the characters %X were replaced by the specified characters.

<Format> // Character string (with quotes), character strings containing optional parameters (character %1 to %n).

<First parameter>, <Second parameter>, ... // Optional character string (with quotes)
//Parameters inserted in the formatted character string.
<First parameter> // will replace the character %1,
<Second parameter> // will replace the character %2, etc.
//The number of characters specified must be identical or greater than the number of parameters used in the character string <Format>.
//If the <Format> character string contains more parameters, the additional parameters will be replaced by empty strings.


StringCompare

Use

//Compares two character strings based on specific criteria.

MyString1 is a string = "WinDev is great"
MyString2 is string = "WinDev 7 is great"
Result is int = StringCompare(MyString1, MyString2)
// Result = -1

Syntax

<Result> = StringCompare(<First string>, <Second string>[, <Options>])

-Parameters detail

<Result> // Integer
0 // if the character strings are equal,
-1 // if <First string> is smaller than <Second string>,
1 // if <First string> is larger than <Second string>.

<First string> // Character string (with quotes), character string to compare.

<Second string> // Character string (with quotes), character string to compare.

<Options> // Constant or combination of constants, optional, comparison option :
ccLexicographicOrder //Comparing character string based on the lexicographic order (for example, the character 'é' is found between the characters 'e' and 'f')
ccNormal //(by default), normal comparison, similar to comparison operators of type <, <=, >, >=, =, ...
ccIgnoreAccent //Comparison without taking the accents into account
ccIgnoreCasse //Non-case sensitive comparison (uppercase/lowercase)
ccIgnoreSpace //Comparison without taking into account spaces before and after the character strings to compare
ccIgnorePonctuationAndSpace //Comparison without taking into account punctuation or spaces

Notes

-Equivalence between the StringCompare function and the comparison operators

-Operator = :
//The = operator is equivalent to the following code :
StringCompare(<String1>, <String2>, ccNormal)

-Operator ~= :
//The ~= operator is equivalent to the following code :
StringCompare(<String1>, <String2>, ccIgnoreCasse, + ccIgnoreAccent + ccIgnoreSpace)

-Operator ~~ :
//The ~~ operator is equivalent to the following code :
StringCompare(<String1>, <String2>, ccIgnoreCasse, + ccIgnoreAccent + ccIgnoreSpace + ccIgnorePonctuationAndSpace)

//For more details about the comparison operators, see Comparison operators.


StringCount

Use

//Calculates the number of occurrences of a specific character string (meeting the search criteria) in another character string.

Res =StringCount("anastasia", "a") // Returns 4
Res = StringCount("toto titi tito", "to") // Returns 3
Res = StringCount("toaster", "X") // Returns 0

StringCount("The bird is in the tree", "The") // returns 1
StringCount("The bird is in the tree","The", WholeWord) // returns 1
StringCount("The bird is in the tree","The", IgnoreCase) // returns 2
StringCount("The bird is in the tree","The", IgnoreCase + WholeWord) // returns 2

Syntax

<Result> = StringCount(<Source string>, <string sought> [, <Options>])

-Parameters detail

<Result> // Integer, number of occurrences or 0 if no occurrence is found or if <String sought> corresponds to an empty string(" ").

<Source string> // Character string, text in which the occurrences of the <String sought> must be looked for.

<string sought> // Character string, text to look for in the <Source string>.

<Options> // Constant or combination of constants, optional, search options :
WholeWord //Search whole word only, meaning a word in-between punctuation characters or spaces.
IgnoreCase //Search without taking the character case (uppercase/lowercase) into account.


StringFormat

Use

//Formats a character string according to the options chosen.

MyString1 is string = "WinDev is great"
MyString1 = StringFormat(MyString1, ccUpCase)

Syntax

<Result> = StringFormat(<string>, <Options>)

-Parameters detail

<Result> // Character string, string formatted according to the chosen criteria.

<string> // Character string (with quotes), character string to format.

<Options> // Constant or combination of constants, formatting options :
ccUpCase //Changes the character string into uppercase (including accented characters)
ccLowCase //Changes the character string into lowercase
ccIgnoreAccent //Format without accent
ccIgnoreSpace //Removes spaces before and after the character string
ccIgnorePonctuationAndSpace //Removes punctuation and spaces


StringRetrieve

Use

//Recovers a character string in a format external to WinDev (character string that is the result of a Windows API call for example).

Syntax

<Result> = StringRetrieve(<Parameter>,<Option>)

-Parameters detail

<Result> // Character string, result string in WinDev format.

<Parameter> // information used to recover the character string.

<Option> // Constant,
//format of the string to recover.
srASCIIZAddress //<Parameter> must be an integer containing the address of a string in ASCIIZ format.


SQLTransaction

Nouvelle page
Saisissez ici le texte de la page


ZStatAverage

Use example for the StatAverage function

-Calculates the geometric mean of a series of values

//The following code calculates the geometric mean (statGeometric constant) of the elements on row 3.
//We assume that the matrix has already been created and initialized.

// Variable declaration
MeanRes is real

// Geometric mean of the elements in row 3
MeanRes = StatAverage("MyMatrix", statGeometric, 3, False)

// Error on the StatAverage function?
IF StatError= 0 THEN
// Display result
Aresult("The geometric mean is: "+MeanRes)
ELSE
// Display error message
Aresult(ErrorInfo(errMessage))
END


ZStatAverageDeviation

Use example for the StatAverageDeviation function

-Calculate the mean deviation

//The following code calculates the mean deviation for the value of the elements on row 3.
//We assume that the matrix has already been created and initialized.

// Variable declaration
MeanDeviationRes is real

// Mean deviation of the value of the elements in row 3
MeanDeviationRes = statAverageDeviation("MyMatrix", 3, False)

// Display coefficient
IF MeanDeviationRes <> 0 THEN
Aresult("The mean deviation is: "+MeanDeviationRes)
ELSE
// Error while calculating the mean deviation?
IF StatError <> 0 THEN
Aresult("The mean deviation is null")
ELSE
// Display an error message
Aresult(ErrorInfo(errMessage))
END
END


ZStatCorrelation

Use example for the StatCorrelation function

-Calculation of the correlation coefficient

//The following code calculates the correlation coefficient between row 3 and row 5 of a matrix.
//We assume that the matrix has already been created and initialized.

// Variable declaration
CorrelationCoefRes is real

// Correlation coefficient between row 3 and row 5 of a matrix
CorrelationCoefRes = StatCorrélation("MyMatrix", 3, 5, False)

// Display coefficient
IF CorrelationCoefRes <> 0 THEN
Aresult("The correlation coefficient is: "+CorrelationCoefRes)
ELSE
// Error while calculating the correlation coefficient?
IF StatError <> 0 THEN
Aresult("The correlation coefficient is null")
ELSE
// Display an error message
Aresult(ErrorInfo(errMessage))
END
END


ZStatCovariance

Use example for the StatCovariance function

-Calculating the covariance

//The following code calculates the covariance between row 3 and row 5 of a matrix.
//We assume that the matrix has already been created and initialized.
Click code of CovarianceBtn

// Variable declaration
CovariancefRes is real

// Covariance between the elements of row 3 and the elements or row 5
CovariancefRes = StatCovariance("MyMatrix", 3, 5, False)

// Display covariance
IF CovariancefRes <> 0 THEN
Aresult("The covariance is: "+CovariancefRes)
ELSE
// Error while calculating the covariance?
IF StatError <> 0 THEN
Aresult("The covariance is null")
ELSE
// Display an error message
Aresult(ErrorInfo(errMessage))
END
END


ZStatError

Use example for the StatError function

-Display the error message

//The following code calculates the standard deviation of the value of the elements in row 3.
//The StatError function lets you check that no error has been generated during the calculation.
//We assume that the matrix has already been created and initialized.

// Variable declaration
StandardDeviationRes is real

// Standard deviation of the value of the elements in row 3
StandardDeviationRes = StatStandardDeviation("MyMatrix", 3, False)

// Display result
IF StandardDeviationRes <> 0 THEN
Aresult("The standard deviation is: "+StandardDeviationRes)
ELSE
// Error while calculating the standard deviation?
IF StatError <> 0 THEN
Aresult("The standard deviation is null")
ELSE
// Display an error message
Aresult(ErrorInfo(errMessage))
END
END


ZStatMax

Use example for the StatMax function

-Calculates the maximum value of a series of values

//The following code determines the maximum value of the elements in row 3.
//We assume that the matrix has already been created and initialized.

// Variable declaration
MaxRes is real

// Maximum value of the elements in row 3
MaxRes = StatMax("MyMatrix", 3, False)

// Error on the StatMax function?
IF StatError<> 0
THEN
// Display result
Aresult("The maximum value is: "+MaxRes)
ELSE
// Display error message
Aresult(ErrorInfo(errMessage))
END


ZStatMin

Use example for the StatMin function

-Calculates the minimum value of a series of values

//The following code determines the minimum value of the elements in row 3.
//We assume that the matrix has already been created and initialized.
Click code of MinBtn

// Variable declaration
MinRes is real

// Minimum value of the elements in row 3
MinRes = StatMin("MyMatrix", 3, False)

// Error on the StatMin function?
IF StatError= 0 THEN
// Display result
Aresult("The minimum value is: "+MinRes)
ELSE
// Display error message
Aresult(ErrorInfo(errMessage))
END


ZStatStandardDeviation

Use example for the StatStandardDeviation function

-Calculate the standard deviation

//The following code calculates the standard deviation for the value of the elements on row 3.
//We assume that the matrix has already been created and initialized.

// Variable declaration
StandardDeviationRes is real

// Standard deviation of the value of the elements in row 3
StandardDeviationRes = StatStandardDeviation("MyMatrix", 3, False)

// Display result
IF StandardDeviationRes <> 0 THEN
Aresult("The standard deviation is: "+StandardDeviationRes)
ELSE
// Error while calculating the standard deviation?
IF StatError <> 0 THEN
Aresult("The standard deviation is null")
ELSE
// Display an error message
Aresult(ErrorInfo(errMessage))
END
END


ZStatStandardDeviationP

Use example for the StatStandardDeviationP function

-Calculate the standard deviation

//The following code calculates the standard deviation of the values of the elements on row 3.
//The value of the elements on this line represent the entire population.
//We assume that the matrix has already been created and initialized.

// Variable declaration
StandardDeviationPRes is real

// Standard deviation of the value of the elements in row 3
StandardDeviationPRes = StatStandardDeviationP("MyMatrix", 3, False)

// Display result
IF StandardDeviationPRes <> 0 THEN
Aresult("The standard deviation is: "+StandardDeviationPRes)
ELSE
// Error while calculating the standard deviation?
IF StatError <> 0 THEN
Aresult("The standard deviation is null")
ELSE
// Display an error message
Aresult(ErrorInfo(errMessage))
END
END


ZStatSum

Use example for the StatSum function

-Add up a series of values

//The following code adds up the elements in row 3.
//We assume that the matrix has already been created and initialized.

// Variable declaration
SumRes is real

// Add up elements in row 3
SumRes = StatSum("MyMatrix", 3, False)

// Error on the StatSum function?
IF StatError = 0 THEN
// Display result
Aresult("The sum is: "+SumRes)
ELSE
// Display error message
Aresult(ErrorInfo(errMessage))
END


ZStatVariance

Use example for the StatVariance function

-Calculating the variance

//The following code calculates the variance of the elements on row 3 of a matrix.
//We assume that the matrix has already been created and initialized.

// Variable declaration
VariancefRes is real

// Variance of the elements in row 3
VarianceRes = StatVariance("MyMatrix", 3, False)

// Variance calculation error?
IF StatError = 0 THEN
// Display variance
Aresult("The variance is: "+VarianceRes)
ELSE
// Display error message
Aresult(ErrorInfo(errMessage))
END


ZStatVarianceP

Use example for the StatVarianceP function

-Calculating the variance

//The following code calculates the variance of the elements on row 3 of a matrix.
//The value of the elements in this row represents the entire population.
//We assume that the matrix has already been created and initialized.

// Variable declaration
VariancePRes is real

// Variance of the elements in row 3
VariancePRes = StatVarianceP("MyMatrix", 3, False)

// Variance calculation error?
IF StatError= 0 THEN
// Display variance
Aresult("The variance is: "+VariancePRes)
ELSE
// Display error message
Aresult(ErrorInfo(errMessage))
END


ZFinCurrentVal

Use example for the FinCurrentVal function

-Current value of an investment.

//The following code calculates the current value for an investment.
//The payment amount, the future value, the number of periods and the interest rate are entered
//by the end user in edit controls (PaymentValue, FutureValue, NbPeriods, Rate).

//Let's assume that the payments are made at the end of the period (False constant).

// Variable declaration
CurrentValRes is real

// Calculate current value
CurrentValRes = FinCurrentVal(-PaymentValue, FutureValue, NbPeriods, Rate, False)

IF FinError= 0 THEN
Aresult("The current value is: "+CurrentValRes)
ELSE
// Display error message
Aresult(ErrorInfo(errMessage))
END


ZFinDecreasingRedemption

Use example for the FinDecreasingRedemption function

-Value of a fixed rate amortization

//The following code return an amortization value.
//The acquisition cost and the residual value of the good, the amortization length,
//the period over which the amortization must be calculated and the number of months
//in the first year of amortization are entered by the end user in edit controls (Cost, ResidulaVal, Length, Period, NbMonth).

// Variable declaration
AmortizationValRes is a real

// Calculate the amortization value

AmortizationValRes = FinDecreasingRedemption(Cost, ResidualVal, Length_, Period, NbMonth)

IF AmortizationValRes<>0
        // Display result
        y=AmortizationValRes
        Aresult(2,"For Length =",Length_,", the amortization value is: ",AmortizationValRes)
ELSE
        IF AmortizationValRes = 0
                IF FinError = 0
                        Aresult(2,"The amortization value is Null")
                ELSE
                // Display error message
                        Aresult(2,ErrorInfo(errMessage))
                END
        END
END


ZFinError

Use example for the FinError function

-Display the error message

//The following code return an amortization value.
//The acquisition cost and the residual value of the good, the amortization length,
//the period over which the amortization must be calculated and the number of months
//in the first year of amortization are entered by the end user in edit controls (Cost, ResidulaVal, Length, Period, NbMonth).

// Variable declaration
AmortizationValRes is real

// Calculate the amortization value
AmortizationValRes = FinDecreasingRedemption(Cost, ResidualVal, Length, Period, NbMonth)

IF AmortizationValRes<> 0 THEN
// Display result
Aresult("The amortization value is: "+AmortizationValRes)
ELSE
IF AmortizationValRes = 0 THEN
// Error?
IF FinError() = 0 THEN
Aresult("The amortizing value is null")
ELSE
// Display error message
Aresult(ErrorInfo(errMessage))
END
END
END


ZFinFuturVal

Use example for the FinValFutur function

-Future value of an investment

//The following code calculates the future value for an investment.
//The initial capital, the regular deposit, the total number of periods and the interest rate
//are entered by the end user in edit controls (InitCapital, Deposit, NbPeriod, Rate).

//Let's assume that the payments are made at the end of the period (False constant).

// Variable declaration
FutureValRes is real

// Calculate future value
FutureValRes = FinFuturVal(-InitCapital, Deposit, NbPeriod, Rate, False)

IF FinError= 0 THEN
Aresult("The future value is: "+FutureValRes)
ELSE
// Display error message
Aresult(ErrorInfo(errMessage))
END


ZFinInterestRate

Use example for the FinInterestRate function

-Calculate a loan interest rate

//The following code calculates the interest rate of a loan.
//The number of payments required to repay the capital, the payment amount and the loan rate
//are entered by the end user in edit controls (PaymentNb, PaymentAmt, Amount).

// Variable declaration
InterestRateRes is real

// Calculate the interest rate
InterestRateRes = FinInterestRate(PaymentNb, -PaymentAmt, Amount)

IF FinError= 0 THEN
Aresult("The interest rate is : "+InterestRateRes)
ELSE
// Display error message
Aresult(ErrorInfo(errMessage))
END


ZFinLinearRedemption

Use example for the FinLinearRedemption function

-Value of a linear amortization

//The following code return an amortization value.
//The acquisition cost, the residual value of the good and the amortization duration
//are entered directly by the end user in edit controls (Cost, ResidualValue, Duration).

// Variable declaration
AmortizationValRes is real

// Calculate the amortization value
AmortizationValRes = FinLinearRedemption(Cost, ResidualValue, Duration)

IF AmortizationValRes<> 0THEN
// Display result
Aresult("The amortization value is: "+AmortizationValRes)
ELSE
IF AmortizationValRes = 0 THEN
IF FinError() = 0 THEN
Aresult(The amortization value is Null")
ELSE
// Display error message
Aresult(ErrorInfo(errMessage))
END
END
END


ZFinNetCurrentVal

Use example for the FinNetCurrentVal function

-Current net value of an investment.

//The following code calculates the current net value for an investment. This $ 100,000 must bring in :
//$ 6,000 the first year,
//- $ 3,000 the second year,
//$ 4,500 the third year,
//$8, 000 the last year.

//Yearly rate update: 10 %

// Variable declaration
CurrentNetValRes is real

// Create and initialize the matrix
MatCreate("Matrix")
MatWrite("Matrix", -100000, 1, 1)
MatWrite("Matrix", 6000, 1, 2)
MatWrite("Matrix", -3000, 1, 3)
MatWrite("Matrix", 4500, 1, 4)
MatWrite("Matrix", 8000,1, 5)

// Calculate current net value
CurrentNetValRes = FinNetCurrentVal(10, "Matrix", 1)

IF FinError() = 0 THEN
Aresult("The current net value is: "+CurrentNetValRes)
ELSE
// Display error message
Aresult(ErrorInfo(errMessage))
END


ZFinPaymentNb

Use example for the FinPaymentNb function

-Number of payments required to repay a capital

//The following code lets you find out the number of payments required to repay a capital.
//The payment amount, rate and length of the loan are entered by the end user in edit controls (PaymentAmt, Rate, Amount).

// Variable declaration
PaymentNbRes is real

// Calculate the number of payments
PaymentNbRes = FinPaymentNb(-PaymentAmt, Rate, Amount)

IF FinError() = 0 THEN
Aresult(PaymentNbRes+"payments are required")
ELSE
// Display error message
Aresult(ErrorInfo(errMessage))
END


ZFinPeriodInterest

Use example for the FinPeriodInterest function

-Amount of interests due

//The following code lets you find out the amount of interests due.
//The amount, rate, period and length of the loan are entered by the end user in edit controls (Amount, Rate, Period, Duration).

//Let's assume that the values entered by the end user use the same time unit.

// Variable declaration
InterestPeriodRes is real

// Calculate the amount of interests due
InterestPeriodRes = FinPeriodInterest(Amount, Rate, Period, Duration)

IF FinError= 0 THEN
Aresult("The amount of interests due is : "+InterestPeriodRes)
ELSE
// Display error message
Aresult(ErrorInfo(errMessage))
END


ZFinRedemption

Use example for the FinRedemption function

-Amortization matrix

//The following code return an amortization matrix.
//The amortization type is selected by the end user using the SelectAmorType radio button.
//The amount, rate and length of the loan are entered by the end user in edit controls (Amount, rate, Duration).
//The amortization matrix is displayed in a memory table (MatrixTable).

// Variables declaration
AmortizationRes is boolean
AmortTypeRes is int // Retrieve the amortization rate
AddRes is boolean
Index,SelectAmorType,Duration is int

SelectAmorType=1
// Retrieve amortization type
SWITCH SelectAmorType
CASE 1 : AmortTypeRes= finInFine
CASE 2 : AmortTypeRes= finConstantRedemption
CASE 3 : AmortTypeRes= finConstantAnnualPayment
END

// Calculate the amortization
AmortizationRes = FinRedemption("AmortMatrix", AmortTypeRes, Amount, Rate, Duration)

// Calculation error?
IF AmortizationRes= False
// Display error message
Aresult(ErrorInfo(errMessage))
ELSE
// Display the matrix
FOR Index= 1 TO MatNbLine("AmortMatrix")
Aresult(0,MatReadLine("AmortMatrix", Index))
END
END


ZFinRepayVal

Use example for the FinRepayVal function

-Amount of each reimbursement for an investment

//The following code calculates the amount of each payment for an investment.
//The initial capital, the total number of periods and the interest rate
//are entered by the end user in edit controls (InitCapital, NbPeriod, Rate).

//Let's assume that the payments are made at the end of the period (False constant).

// Variable declaration
PaymentValRes is real

// Calculate payment value
PaymentValRes = FinRepayVal(-InitCapital, NbPeriod, Rate, False)

IF FinError= 0 THEN
Aresult("The amount of each payment is: "+PaymentValRes)
ELSE
// Display error message
Aresult(ErrorInfo(errMessage))
END


ZInteger

Integers

Integer types

//The W-Language offers different types of integer :

//type, value included between
int // -2 x 109 and 2 x 109 (approximately)
int on 1 byte // -128 and 127 (included)
int on 2 bytes // -32.768 and 32.767 (included)
int on 4 bytes // -2 x 109 and 2 x 109 (approximately)
int on 8 bytes // -9 x 1018 and 9 x 1018 (approximately)
unsigned int // 0 and 4 x 109
unsigned int on 1 byte // 0 and 255 (included)
unsigned int on 2 bytes //0 and 65.535 (included)
unsigned int on 4 bytes //0 and 4 x 109 (approximately)
unsigned int on 8 bytes //0 and 18 x 1018

Notes

-Default value
//An "integer" type variable that is declared but not initialized is equal to 0.


ZCurrency

Currency

Currency type

//A currency type is a real coded on 10 bytes.
//A currency type can have up to 23 significant digits
//(a maximum of 18 digits for the integer part, and a maximum of 6 digits for the decimal part)
//and can take any value between -604 462 909 807 314 587.353 087 and +604 462 909 807 314 587.353 087.

//You should use the currency type when you want to avoid round-off approximations due to the binary coding of real types.

//For other calculations, use real types as they compute faster.

Notes

-Default value
//A currency type variable that is declared but not initialized is equal to 0.

-/Binary coding for reals
//All Reals have the same number of significant digits (15).
//If the result of a calculation on reals produces more than 15 significant digits,
//the result will automatically be rounded-off to 15 significant digits.
//The accuracy of the result is less than what you obtain when the calculation is performed using currency type.

-Calculations using currency type
//All calculations including at least one currency type will be performed as currency operations.
//In order to guarantee the accuracy of the result, all the operands will be converted automatically to currency type.


ZReal

Real

Real types

//The W-Language offers two types of reals :

real //Real on 8 bytes
//A real can have up to 15 significant digits.
//Decimal precision is not guaranteed.
//To perform precise calculation Use the "Currency" type.

-Value of a real :
// Minimum value : 1.7*10-308
// Maximum value : 1.7*10+308

real on 4 bytes //Real on 4 bytes
//A real coded on 4 bytes can have up to 6 significant digits.
//Decimal precision is not guaranteed.
//To perform precise calculations use the "Currency" type.

-Value of a real on 4 bytes:
// Minimum value: 3.4*10-38
// Maximum value: 3.4*10+38

Notes

-Default value
//A "Real" type variable that is declared but not initialized is equal to 0.

-Binary coding for reals
//All reals have the same number of significant digits (15).
//If the result of a calculation on reals produces more than 15 significant digits,
//the result will automatically be rounded-off to 15 significant digits.
//To obtain a better precision use the currency type.


ZLimites

Limits of the variables Used in the procedures of the actions

Limits of the variables Used in the procedures of the actions

int on 1 byte // -128 To 127
unsigned int on 1 byte // 0 To 255
int on 2 bytes // -32768 To 32767
unsigned int on 2 bytes // 0 To 65535
int on 4 bytes // -2147483648 To 2147483647
unsigned int on 4 bytes // 0 To 4294967295
int on 8 bytes // -9223372036854775808 To 9223372036854775807
unsigned int on 8 bytes // 0 To 18446744073709551615
currency // -604462909807314587.353088 To 604462909807314587.353087
fixed string // Max Length 32767
ASCIIZ string // Max Length 65535
Pascal string // Max Length 255


ZDynamic array

Dynamic array

Use

//A dynamic array is an "advanced" type of array :
//the dimension of the array is determined on demand in the program.
//In most cases, a simple array will do.

-Reminder :
//An array is a structured type that enables you to group elements of the same type.
//Each element of the array can be directly accessed by its Subscript.

//It is better to use :
//a dynamic array or a "simple" array when the size of the array may vary in the program.

Syntax

-Declaring a dynamic array
<array name> is dynamic array

-Detailed Syntax
<dynamic array name> //Name of the dynamic array variable to declare.
//Note : the a keyword is not require: it is used for readability.

ClientArray is dynamic array

-Allocating a dynamic array
<dynamic array name> = new a dynamic array of <Dimension 1> [by <Dimension 2> ... [by <Dimension 10>]] <Data type of array elements>
//or
<dynamic array name> = new a dynamic array of <Dimension 1> [,<Dimension 2> ... [,<Dimension 10>]] <Data type of array elements>

-Detailed Syntax
<dynamic array name> //Name of the dynamic array to use. This array has already been declared.
<Dimension 1>...<Dimension 10> //Dimension 1 to 10 of the array (integer value).
<Data type of array elements> //Data type of the elements that make up the array. See variable data types.

//Note : The a and dynamic keywords are not required; they're used only for readability.

ClientArray is dynamic array
ClientArray = new a dynamic array of 4 by 7 int
// Equivalent to :
ClientArray = new a dynamic array of 4,7 integers

-Referring to a dynamic array
//Note : In order to refer to a dynamic array, the array must be allocated.

-Referring to an element in a one dimensional array :
<array name>[Subscript1]

-Referring to an element in a two dimensional array :
<array name>[Subscript1, Subscript2]
//or
<array name>[Subscript1][Subscript2]

-Referring to an element in a N dimensional array :
<array name>[Subscript1,...,SubscriptN]
//or
<array name>[Subscript1]...[SubscriptN]

-Passing an array as a parameter to a function :
<Procedure name>(<array name>)

-Detailed Syntax
<dynamic array name> //Name of the dynamic array to use.
<Subscript1> //Element Subscript for the 1st dimension.
<Subscript2> //Element Subscript for the 2nd dimension.scriptN> //Element Subscript for the Nth dimension (N <= 10).

//Note : You cannot manipulate an entire array all at once.
//For example, you cannot assign an array to another array.

ClientArray[2,5,3] = 47
// Equivalent to :
ClientArray[2][5][3] = 47

Notes

-Freeing a dynamic array (optional)
//A dynamic array is automatically freed at the end of the variable life (when closing its window for example) or when new dimensions are allocated.

//To explicitly free a dynamic array, use the following syntax :
delete <dynamic array name>

-Declaring a dynamic array member
//You can declare a member of a "dynamic array" type in :
//a structure,
//a composite variable,
//a class.

//The dynamic array allocation must be performed after the declaration of the structure, composite variable or class.
//For example :
// Declaring a structure
Struct is structure
x1 is int
x2 is dynamic array // Declaring the array
END

- Declaring a structure type variable
MyStruct is Struct
// Allocating the array
x2 = new dynamic array of 4,7 int
//Note : in the case of a class, the declaration must be performed in the class declaration code, and the assignments must be done in the class constructor.

-Dynamic array dimension
//The Dimension function enables you to :
//know the number of elements in a dynamic array.
//change a dynamic array dimension.
//Caution : The Dimension function doesn't allow you to change the number of dimensions of a dynamic array.

Restrictions

-Dynamic array elements
//a dynamic array cannot consist of :
//- composite variables.
//- arrays.


ZFixed array

Fixed array

Use

//A fixed array is an "advanced" type of array :
//the dimension of the array is fixed at compile time and cannot be modified.

//The array dimension is set during compilation only if the dimensions correspond to :
//an integer.
//or a previously created variable.

//In all the other cases, a W-Language error will be generated when the project is compiled.

-Reminder :
//An array is a structured type that enables you to group elements of the same type.
//Each element of the array can be directly accessed by its Subscript.

//It is better to use :
//a dynamic array or a "simple" array when the size of the array may vary in the program.

Syntax

-Declaring a fixed array
<array name> is fixed array of <Dimension 1> [by <Dimension 2> ... [by <Dimension 10>]] <Data type of array elements>
//or
<array name> is fixed array of <Dimension 1> [,<Dimension 2> ... [,<Dimension 10>]] <Data type of array elements>

-Detailed syntax
<array name> //Name of the array variable to declare.
<Dimension 1>...<Dimension 10> //Dimension 1 to 10 of the array (integer value).
<Data type of array elements> //Data type of the elements that make up the array.
//See various variable data types.

-Note :
//The a keyword is not require : it is used only for readability.

CustomerArray is fixed array of 5 by 7 by 3 int
// Equivalent to :
CustomerArray is fixed array of 5,7,3 integers

-Referring to a fixed array
//Referring to an element in a one dimensional array:
<array name>[Subscript1]

//Referring to an element in a two dimensional array:
<array name>[Subscript1, Subscript2]
//or
<array name>[Subscript1][Subscript2]

//Referring to an element in a N dimensional array:
<array name>[Subscript1, ... , SubscriptN]
//or
<array name>[Subscript1]...[SubscriptN]

-Detailed syntax

<array name> //Name of fixed array to use.
<Subscript1> //Element Subscript for the 1st dimension.
<Subscript2> //Element Subscript for the 2nd dimension.
<SubscriptN> //Element Subscript for the Nth dimension (N <= 10).

-Note :
//You cannot manipulate an entire array all at once.
//For example, you cannot assign an array to another array.

CustomerArray[2,5,3] = 47
// Equivalent to :
CustomerArray][5][3] = 47

Notes

-Declaring a fixed array member
//You can declare a member of a fixed array in :
//a composite variable. This fixed array is allocated directly into the composite variable memory zone.
//a structure <structure name>. This fixed array is allocated directly in the memory zone of each variable of <structure name> type.

//For example :
Struct is structure
n1 is int
nTab is fixed array of 2 int
n2 is int
END

MyStructure is Struct

-Fixed array dimension
//The Dimension function enables you to find out the number of elements in a fixed array.

-Reminder :
//You cannot change the dimension of a fixed array.

Restrictions

-Elements of a fixed array
//A fixed array cannot consist of:
//- composite variables.
//- arrays.


Retro-calcul

Nouvelles fonctions de « retro-calcul » pour les actions de type procédure :

Les fonctions sont ReStartAt() et ReStartStat()

Principe :

une action qui veut faire un retro-calcul, doit ouvrir une porte vers le passé.
La fonction ReStartAt() permet le retro-calcul et renvoie le numéro de la porte ouverte.
Le numéro de cette porte est associé à l'action en cours et au nombre de temps en cours (nbt).
Il ne peut y avoir plus d'une porte pour une même action et un même nbt.
A ce numéro de porte est associé un compteur de passage par cette porte.
Ce compteur est incrémenté a chaque fois que l'action franchit la porte vers le passé.

Exemple :

L'action "act" appelle la fonction ReStartAt() pour le nbt 10.
Le futur numéro de porte renvoyé par cette fonction vaut 1.
La porte 1 sera créée à la sortie de l'action, et le premier passage sera initialisé à 1.
Le retro-calcul s'effectuera pour les paramètres temporels c et t passés à la fonction, ReStartAt(c,t).
Lorsque l'action "act" revient au nbt 10 et qu'elle rappelle la fonction ReStartAt(),
le retour vers le passé se fera par la porte précédemment créée,
et le compteur de passage sera incrémenté et vaudra 2.
Si l'action "act" passe le nbt 10 sans rappeler la fonction ReStartAt(),
la porte 1 sera supprimée ainsi que son compteur de passage associé.

Ouverture d'un porte vers le passé alors qu'on est déjà dans le passé :

Exemple : l'action "act" a ouvert la porte 1 et elle en est à son 3° passage par cette porte.
Elle revient vers la porte 1, mais avant d'y arriver, elle ouvre une nouvelle porte.
La numéro de la deuxième porte ouverte vaudra 2, et le compteur de passage associé vaudra 1.
Il en est de même pour l'ouverture de nouvelles portes par d'autres actions.

La fonction ReStartAt() :

Elle nécessite les paramètres temporels stipulant le moment passé à partir duquel on veut faire le retro-calcul.
Il est possible également de donner les limites concernant le nombre de passages autorisés par la porte ouverte, et le nombre de portes qui peuvent être ouvertes, selon la manière de les comptabiliser.

Syntaxe de la fonction ReStartAt() :

<résultat>=ReStartAt(<c>,<t>,[<max_passing>],[<max_action_gate>],[<max_link_gate>],
[<max_global_gate>])

ou

<résultat>=ReStartAt(<Faux>,<nbt>,[<max_passing>],[<max_action_gate>],[<max_link_gate>],
[<max_global_gate>])

Détail des paramètres :

<résultat> est le numéro de porte créée ou déjà créée par l'action, pour le nombre de temps en cours (nbt).
Lorsque la porte existe déjà, le compteur de passage est incrémenté.

Si les paramètres suivants sont renseignés, ils serviront de limit
<max_passing> limite le nombre de passage par cette porte.

<max_action_gate> limite le nombre de portes pouvant être initiées par cette action.

En effet, d'autre portes peuvent être initiées pour des nbt différents, par cette action.
Leur nombre ne pourra dépasser cette limite.

<max_link_gate> limite le nombre de portes pouvant être initiées par toutes les actions
du lien contenant l'action en cours.

En effet d'autre portes peuvent être initiées pour d'autres nbt et actions du lien en cours.

<max_global_gate> limite le nombre de portes pouvant être initiées par toutes les actions
de tous les liens de l'élaboration.

Si une des limites est atteinte, la porte n'est pas créée ou le passage ne se fait pas, et la porte, si elle existe déjà, sera supprimée à la sortie de l'action.

La fonction ReStartStat() :

Elle renseigne sur l'état des portes de l'élaboration.
Elle renseigne la structure g qui contient les paramètres suivants :
La structure g est une structure globale accessible dans la procédure de l'action en cours.

action_gate //numéro de la porte pour le nombre de temps (nbt) et l'action en cours, si existante
action_passing //numéro de passage pour la porte numéro <action_gate> si existante

nb_action_gate //nombre de portes ouvertes par l'action en cours
nb_link_gate //nombre de portes ouvertes par le lien cours

nb_global_gate //nombre de portes ouvertes par l'élaboration
global_passing //dernier passage de la dernière porte vers le passé

f_action_gate //booléen, vrai si le nbt en cours est un nbt d'ouverture de porte par l'action en cours
f_link_gate //booléen, vrai si le nbt en cours est un nbt d'ouverture de porte par le lien en cours

f_global_gate //booléen, vrai si le nbt en cours est un nbt d'ouverture de porte par l'élaboration

t_action_gate //tableau contenant les numéros de portes ouvertes par l'action en cours
t_link_gate //tableau contenant les numéros de portes ouvertes par le lien en cours

Syntaxe de la fonction ReStartStat() :

Première syntaxe :

ReStartStat()

Les éléments de la structure g seront renseignés comme précisé ci-dessus.

Deuxième syntaxe :

<résultat>= ReStartStat(<porte>)

Détail des paramètres :

<résultat> est un entier : c'est le dernier numéro de passage de la porte <porte>.
<porte> est un entier : c'est le numéro de porte dont on veut obtenir le numéro du dernier passage.


Svalue

Svalue (TRUE function)

Use

//Return the value of one stock of the model.

-Example 1

//y is the return value of the procedure
y = Svalue("b")
//y = value of the stock b pour current cycle c and current time t

-Example 2

//y is the return value of the procedure
//c is the current cycle
//t is current time unit
c_, t_ are int
c_= 4; t_= 10
IF c_ <= c AND t_ <= t THEN y = Svalue("b",c_,t_)
//y = value of the stock b for cycle c_=4 and time t_ = 10

-Example 3

//y is the return value of the procedure
//nbt is the current number of time, for all cycles
nbt_ is int
nbt_= nbt-10
IF nbt_ > 0 THEN y = Svalue("b",False,nbt_)
//y = value of the stock b for time nbt - 10

First Syntax

Svalue(<Stock name>,[<Cycle>,<Time>] )

-Parameter details

<Stock name> // Character string, is the stock name which value must be obtained.
<Cycle> // Optional integer, is cycle for which the value must be obtained.
<Time> // Optional integer, is time unit for which the value must be obtained.
//If parameters <Cycle> and <Time>, do not correspond to a valid value, the function will return 0.

Second Syntax

Svalue(<Stock name>,[<False>,<Number of time>] )

-Parameter details

<Stock name> // Character string, is the stock name which value must be obtained.
<False> // Optional boolean, replaces <Cycle> parameter, and indicates that the parameter <Number of time>, must correspond to the variable nbt, which represents the number of time for all cycles.
<Number of time> // Optional integer, which is equal to the number of time for all cycles.
//If parameters <Number of time>, doesn't correspond to a valid value, the function will return 0.


Tangent

Use

//Calculates an angle's tangent.

// Tangent of 45
TangentRes = Tangent(45)
// Returns 1

Syntax

<Result> = Tangent(<Angle>)

-Parameters detail

<Result> // Real, orientation of the specified angle.

<Angle> // Integer or real, angle (in degrees) to manipulate.
//If this parameter is set to 90°, -90°, 270° or -270°, a W-Language error occurs.


Trace

Use

//Displays the information requested (content of a control for example) in a window opened in parallel to the current window.

-Note :
//The Trace function is useful in the development phase of a project to check that everything is working as intended.

// Display information into the trace window
Trace("Calculation result: " + CalculationRes)

Syntax

Trace(<Information> [, <Additional information> ...])

-Parameters detail

<Information> // Any type, set of elements to display in the trace window.

<Additional information> // Any type, additional elements to display in the trace window.
//Will be displayed on the same line as <Information>.

Notes

-Trace window
//The pieces of information passed as parameters are displayed on the next line of the trace window.

//The trace window is automatically opened with the first call to the Trace function (the StartTrace function is performed automatically).
//By default, this window is opened in the upper left side of the screen.

//The way the Trace function works is similar to the way the Info function works but the display is done in a parallel window, without waiting for a keystroke.

//If the window that called the trace window looses focus, the information in the Trace window becomes invalid.

//The popup menu of the Trace window lets you :
//- copy/cut/past the content of the trace window.
//- open the Trace window on top of all the other windows (including windows from other applications).
//- store the size and location of the trace window when closing it. When re-displaying this window, it'll be displayed according to the size and position stored.
//- display an horizontal scroll bar.
//- display special characters in gray and spelled out: EOT, TAB, etc. For example, the carriage return characters (CR) present correspond to "<\r><\n>".

-Note :
//This option is taken into account with the next line of information displayed.


TypeVar

Use

//Identifies the type of an expression, a variable (when calling a procedure for example) or a control.

TypeVar(Parameter)

Syntax

<Result> = TypeVar(<Expression>)

-Parameters detail

<Result> // Integer, identifies the type of the variable or of the control's value.
0 //for controls that do not return a value (button, OLE control, etc.)
wlBoolean //Boolean
wlUnsignedInt_1 //Unsigned integer coded on 1byte
wlUnsignedInt_2 //Unsigned integer coded on 2 bytes
wlUnsignedInt_4 //Unsigned integer coded on 4 bytes
wlUnsignedInt_8 //Unsigned integer coded on 8 bytes
wlInt_1 //Signed integer coded on 1byte
wlInt_2 //Signed integer coded on 2 bytes
wlInt //Signed integer coded on 4 bytes
wlInt_8 //Signed integer coded on 8 bytes
wlCurrency //Currency
wlReal_4 //Real coded on 4 bytes
wlReal //Real coded on 8 bytes
wlHandle //Window handle
wlCharacter //Character
wlString //Character string
wlDataSource //Data source
wlPascalString //Pascal string
wlFixedString //Fixed string
wlASCIIZString //ASCIIZ string
wlDate //Date
wlTime //Time
wlDateTime //DateTime
wlDuration //Duration
wlBinaryString //Binary string
wlBinaryMemo //Binary memo
wlVariant //Variant
wlAutomation //Automation object
wlOLEControl //OLE control
wlArray //Table
wlComposedVariable //Composite variable
wlStructure //Structure
wlInstance //Class instance
wlFileDescription //Hyper File file description
wlItemDescription //Hyper File item description
wlLinkDescription //Hyper File link description
wlFont //Font

<Expression> // Character string, name of the W-Language variable or control for which we want to find out the type.


Upper

Use

//Converts a character string into uppercase based on the localization parameters defined in Windows

Upper("abcd") // Returns "ABCD"
Upper("Cream") // Returns "CREAM"

Syntax

<Result> = Upper(<Character strings>)

-Parameters detail

<Result> // Character string, character string in uppercase.

<Character string> // Character string, character string to convert into uppercase.

Notes

-Conversion rules
//Non accented lowercase letters are converted into non accented uppercase letters.
//Accented lowercase letters are converted into non accented uppercase letters.
//Non accented uppercase letters remain as non accented uppercase letters.
//Accented uppercase letters remain as accented uppercase letters.

-Miscellaneous
//"Blanks" remain the same.


Val
Use

//Returns the numeric value of a character string. This allows you to perform numeric calculations on character strings.

Val("143") // Returns 143
Val("1.67") // Returns 1,67
Val("ABC") // Returns 0
Val("3plus2") // Returns 3
Val("7,5") // Returns 7
Val("1D2") // Returns 100
Val("2.5e-2") // Returns 0.025

Syntax

<Result> = Val(<Source string> [, <Base Used>])

-Parameters detail

<Result> // Real or integer, numeric value of the string.
0 //in case of an error.

<Source string> // Character string, character string to convert into a numeric value.
//For a real, the separator must be the point '.' and the prefix for scientific notation can be 'E','e', 'D' or 'd'.
//If the separator is a comma, the numbers found after the comma are ignored.

<Base Used> // Character string or integer (optional), base in which the number is represented.
//The authorized values are as follows :
"d" // base 10 (decimal)
"x" // base 16 (hexadecimal)
"o" // base 8 (octal)
//an integer found between 2 and 36

Notes

-Miscellaneous
//As soon as a character from <Source string> cannot be translated into a number,
//the Val function stops interpreting <Source string>, and returns the number corresponding to the characters already read.

//Real can only be converted in base 10.
//In other bases, characters found after the "." (point) are ignored.


ValueRead

ValueRead (TRUE function)

Use

//Read a pseudo-variable value, stored in a file.
//This function allows to read pseudo-variable values, written by ValueWrite() function.
//The pseudo-variable values can be displayed in "Values" window, after elaboration computing

-Note :
//When locally computing in "Procedure" window, the read pseudo-variable value is the value stored during elaboration computing, except if this value is locally overwritten.

-Example 1

//y is the return value of the procedure
y = ValueRead("ab")
//y is set up with the value of the pseudo-variable named "ab"

-Example 2

Name is string
Name = ValueRead("name")
//Name is set up with the value of the pseudo-variable named "name"

-Example 3

Amount is currency
Amount = ValueRead("amount")
//Amount is set up with the value of the pseudo-variable named "amount"

Syntax

<Result> = ValueRead(<Pseudo-variable Name> )

-Parameter details

<Result> // character string containing the value stored under the name < Pseudo-variable name >.
//The string length is limited to 100 characters.

<Pseudo-variable Name> // integer or character string specifying the name of the pseudo-variable.
//The string length of this name is limited to 40 characters.


VariantConvert

Nouvelle page
Saisissez ici le texte de la page


ValueWrite

ValueWrite (TRUE function)

Use

//Store in a file a value corresponding to a name.
//This function allows to simulate declaration and initialisation of pseudo-variables.
//The values can be read with ValueRead() function.
//The pseudo-variable values are displayed in "Values" window, after elaboration computing.

-Note :
//When locally computing procedure in "Procedure" window, the stored values by the elaboration computing are not affected.

-Example 1

//y is the return value of the procedure
ValueWrite("ab", y)
// y value is stored in pseudo-variable named "ab"

-Example 2

ValueWrite("product number", 300)
//the value 300 is stored in pseudo-variable named "product number"

-Example 3

ValueWrite("name", "SMITH")
//the string "SMITH" is stored in the pseudo-variable "name"

-Example 4

ValueWrite("dim")
//value of the pseudo-variable named "dim" is deleted

-First syntax
ValueWrite(<Pseudo-variable name>,[<Pseudo-variable value>] )

-Parameter details

<Pseudo-variable name> // integer or character string to name the pseudo-variable.
//This name will be stored in a character string limited to 40 characters.

<Pseudo-variable value> // optional value of the pseudo-variable.
//This value will be stored in a character string limited to 100 characters.


YesNo

Use

//Displays a message in a standard dialog box offering the answers "Yes" and "No" and returns the user's answer.

//To close the window, the user must validate one of the buttons.

// Exit choice
IF YesNo("Do you want to exit the program?") = Yes THEN Close

Syntax

<Result> = YesNo([<Selected button>], <Text> [, <Line 2> ... [, <Line n>]])

-Parameters detail

<Result> // Integer type constant, identifies the button selected by the user :
No //0, the user has chosen the button [NO]
Yes //1, the user has chosen the button [YES]

<Selected button> // Optional integer type constant, button selected by default in the dialog box :
No //0, Button [NO] selected by default
Yes //(by default) 1, Button [YES] selected by default

<Text> // Character string, text to print

<Line 2> ... <Line n> // Optional character strings, text displayed on the following lines.

Notes

-Characteristics of the dialog box
//The title of the dialog box is the title of the current window.
//The message is aligned to the left.
//The buttons' labels are based on the Windows execution language.
//The maximum number of characters displayed is limited to 4096.
//If a larger string is passed as a parameter, it will be truncated.
//The icon displayed cannot be modified (exclamation mark).

-Line break in the dialog box
//The CR (Carriage Return) pre-defined string can be used to force a break to the next line.
//For example :
YesNo("The form XXX has been modified." + CR + "Do you want to save the changes?")
//is equivalent to :
YesNo("The form XXX has been modified.","Do you want to save the changes?")


xlsClose

Use

//Closes an XLS file.
// Opening an XLS fileId = xlsOpen("C:\MyDirectory\File.XLS")...// Closing the XLS filexlsClose(Id)

Syntax

xlsClose(<XLS file identifier>)

-Parameter detail

<XLS file identifier> // Intege
//Identifier of the XLS file to close; returned by the xlsOpen function


xlsCurrentWorksheet

Use

Lets you know or modify the current sheet of a XLS file.

Note : In the multi-sheets, management functions XLS always work on the current sheet.
At the opening of the file XLS, first sheet of the leaf binder is common place.

id is integer
id = xlsOpen("File.XLS")
//or
id = xlsOpenExport("File.XLS")

//manipulate XLS file
//...
//To know the current sheet
sheet is integer
sheet = xlsCurrentWorksheet(id)
//Positioning on the last sheet of the file
NbSheet is integer = xlsNbWorksheet(id)
IF xlsCurrentWorksheet(id,NbSheet) THEN
Info("Current sheet is modified")
END

Syntax : know the current sheet<Result> = xlsCurrentWorksheet(<Identifier of the XLS file>)

- Parameters detail

<Result> : // Integer
// Identifier of the current sheet. This value is between 1 et xlsNbWorksheet()
<Identifier of the XLS file> : // Integer
Identifier of the specified XLS file or -1 in case of an error. This identifier will be used with all the XLS functions.

Syntax : modify the current sheet
<Result> = xlsCurrentWorksheet(<Identifier of the XLS file>, <Sheet Number>)

- Parameters detail

<Result> : // Boolean
// True if current sheet is modified,
//False in other case, for example if the sheet doesn't exist
<Identifier of the XLS file> : // Integer
Identifier of the specified XLS file or -1 in case of an error. This identifier will be used with all the XLS functions.
<Sheet Number> : // Integer
// number of the new sheet
//This value must be between 1 et xlsNbWorksheet()


xlsData

Use

Retrieves the data from a cell of the XLS file.

Note : The content of an XLS file cell can only be retrieved if :
- The XLS file exists.
- The XLS file is opened.
- This cell is present on the first worksheet of the book.

// Opening an XLS fileId = xlsOpen("C:\MyDirectory\File.XLS")IF Id <> -1 THEN // Retrieving the value of a cell Data= xlsData(Id, 3, 4) ...
END

Syntax

<Result> = xlsData(<XLS file identifier>, <Row number>, <Column number> [, <Empty rows and columns>])

-Parameters detail

<Result> : Character string
Content of the specified cell or constant xlsDataErrorin case of an error.

<XLS file identifier> : Integer
Identifier of the XLS file to use, returned by the xlsOpen function.

<Row number> : Integer
Row number of the cell to read.

<Column number> : Integer
Column number of the cell to read.

<Empty rows and columns> : Optional boolean
True
(by default)
Completely empty rows and columns are not counted
False Completely empty rows and columns are counted


xlsMsgError
Use

Returns the text of the last error caused by an XLS function.

// Opening an XLS file
id is integer
id = xlsOpen("XLS file")
//or
id = xlsOpenExport("XLS file")
//...

IF id <> -1
Info("XLS file opened")
ELSE
ErrorRes = xlsMsgError(id)
END

Syntax :
<Result> = xlsMsgError(<XLS file identifier>)

-Parameters detail

<Result> : // Character string
// Text of the last error that occurred on the XLS file or empty string (" ") if no error occurred..
<XLS file identifier> : // integer
Identifier of the current XLS file; returned by the function xlsOpen() ou xlsOpenExport()

Notes :

Various errors
//he errors that may occur on the XLS functions are:

The XLS file isn't found, doesn't exist, is not opened, is invalid or can't be opened.

The row and/or column specified are empty or don't exist.

Not enough memory to open file.

The version of Excel used is too old (XLS functions cannot read files in Excel version 2 format or older).

Equivalent function

//The ErrorInfo function used with the errMessage constant also returns the text of the last error that occurred.


xlsNbColumn

xlsNbColonne

Use

Returns the number of columns of the first worksheet of an XLS file.

This function assumes that the XLS file has a structure similar to a database, that is to say, each row corresponds to a fixed number of columns.

Note :
The number of columns of an XLS file can be obtained only if :
- the XLS file exists.
- the XLS file is opened.

// Opening XLS fileId = xlsOpen("C:\MyDirectory\File.XLS")IF Id <> -1 THEN// Number of columnsNumColumnRes= xlsNbColumn(Id)...END

Syntax

<Result> = xlsNbColumn(<XLS file identifier> [, <Empty columns>])

-Parameters detail

Result> : Integer
Number of columns in the specified XLS file or -1 in case of error.

<XLS file identifier> : Integer
Identifier of the XLS file to use, returned by the xlsOpen function.

<Empty columns> :Optional constant
True (by default)
Totally empty columns are not counted

False
Totally empty columns are counted


xlsNbRow

xlsNbLigne

Use

Returns the number of rows of the first worksheet of an XLS file.

Note : The number of rows of an XLS file can be obtained only if:
- the XLS file exists.
- the XLS file is opened.

// Opening XLS fileId = xlsOpen("C:\MyDirectory\File.XLS")IF Id <> -1 THEN// Number of rowsNumRowRes= xlsNbRow(Id)...END

Syntax

<Result> = xlsNbRow(<XLS file identifier> [, <Empty rows>])

-Parameters detail

<Result> : Integer
Number of rows in the specified XLS file or -1 in case of error.

<XLS file identifier> : Integer
Identifier of the XLS file to use, returned by the xlsOpen function.

<Empty rows> :Optional constant
True (by default)
Totally empty rows are not counted

False
Totally empty rows are counted


xlsNbWorksheet

Use

Returns the number of sheets of an XLS file.

//manipulate XLS file
id is integer
id = xlsOpen("XLS file")
//or
id = xlsOpenExport("XLS file")
//...

//Know the number of sheet of the file
NbSheet is integer
NBSheete = xlsNbWorksheet(id)

Syntax : Know the number of sheets

<Result> = xlsNbWorksheet(<Identifier of the XLS file>)

-Parameters detail

<Result> : // Integer
// Number of sheets of the XLS file or -1 in case pf error.
To find the wording of error, use the function xlsMsgError() or the function ErrorInfo() with the constant errMessage.
<Identifier of the XLS file> : // Integer
// Identifier of the XLS file, returned by the function xlsOpen() ou xlsOpenExport()


xlsOpen

xlsOuvre

Use

//Open an XLS file.

// Opening an XLS fileXLSFileId = xlsOpen("C:\MyDirectory\File.XLS")...

Syntax

<Result> = xlsOpen(<XLS file path>)

-Parameters detail

<Result> : Integer
Identifier of the specified XLS file or -1 in case of an error. This identifier will be used with all the XLS functions.

<XLS file path> : Character string
Full or relative path of the XLS file to open (maximum 260 characters).

Notes

The XLS file could not be opened.

The xlsOpen function returns -1 in the following cases:
- couldn't find the specified XLS file.
- the specified XLS file does not exist.
- the specified XLS file can't be opened.
- the specified XLS file is invalid.
- not enough memory to open XLS file.
- the version of Excel used is too old (XLS functions cannot read files in Excel version 2 format or older).

To find out the text of the error, use the xlsMsgError function or the ErrorInfo function with the errMessage constant.


xlsTitreColonne

Nouvelle page
Saisissez ici le texte de la page


xlsTypeColonne

Nouvelle page
Saisissez ici le texte de la page


xlsVersion

Nouvelle page
Saisissez ici le texte de la page


xlsOpenExport

Use

//Open an XLS file in the ...\Export directory of the current model.

Note 1 :
If the XLS file is already open by Excel, it will be duplicated in the directory export, and this duplicate file will be opened.

Note 2 :
By default, the XLS file is opened in multi-mode sheets: the different sheets of binder are managed.
For information or modify the current sheet utilsez function xlsCurrentWorksheet()

Caution: Only XLS files are managed. The files specific to Office 2007 (. Xlsx) are not managed.

Id = xlsOpenExport("File.XLS")...

Syntax

<Result> = xlsOpenExport(<XLS file name>)

-Parameters detail

<Result> : Integer
Identifier of the specified XLS file or -1 in case of an error. This identifier will be used with all the XLS functions.

<XLS file path> : Character string
Name of the XLS file to open (maximum 260 characters).

Notes

The XLS file could not be opened.

The xlsOpen function returns -1 in the following cases:
- couldn't find the specified XLS file.
- the specified XLS file does not exist.
- the specified XLS file can't be opened.
- the specified XLS file is invalid.
- not enough memory to open XLS file.
- the version of Excel used is too old (XLS functions cannot read files in Excel version 2 format or older).

To find out the text of the error, use the xlsMsgError function or the ErrorInfo function with the errMessage constant.