I have declared a functional class called "FCArray" to store an array of arrays. Within this class I have declared arrays of multiple data types and a numeric variable to store the type of the array:
Code: Select all
Functional Class: FCArray
Description: Array-Klasse für Skripte
Derived From
Class Variables
Instance Variables
Boolean: ba[*]
Number: na[*]
Date/Time: da[*]
String: sa[*]
Long String: la[*]
Number: nType
Functions
Function: fcClear
Description: Array leeren
Returns
Parameters
Static Variables
Local variables
Actions
Call SalArraySetUpperBound( ba, 1, -1 )
Call SalArraySetUpperBound( da, 1, -1 )
Call SalArraySetUpperBound( la, 1, -1 )
Call SalArraySetUpperBound( na, 1, -1 )
Call SalArraySetUpperBound( sa, 1, -1 )
Function: fcSetType
Description: Typ des Arrays
Returns
Parameters
Number: nPar
Static Variables
Local variables
Actions
Set nType = nPar
Function: fcGetType
Description: Typ des Arrays
Returns
Number:
Parameters
Static Variables
Local variables
Actions
Return nType
Code: Select all
Function: appDateFunction
Description: any function
Returns
Boolean:
Parameters
Receive Date/Time: dParDate[*]
Static Variables
Local variables
Actions
! Do anything or nothing
Return TRUE
Function: appStringFunction
Description: any function
Returns
Boolean:
Parameters
Receive String: sParString[*]
Static Variables
Local variables
Actions
! Do anything or nothing
Return TRUE
Function: appNumberFunction
Description: any function
Returns
Boolean:
Parameters
Receive Number: nParString[*]
Static Variables
Local variables
Actions
! Do anything or nothing
Return TRUE
Code: Select all
Local variables
FCArray: aa[*]
call the function appStringFunction( aa[0].sa )
and then query the type with aa[0].fcGetType( )
The result is "5" for string variables. Doing the same with the number function it is ok too.
But if you are using the date/time data type the result is buggy:
Call aa[0].fcSetType( DT_DateTime )
Query aa[0].fcGetType( ) gets the correct result DT_DateTime = 2
Call appDateFunction( aa[0].da )
Then query aa[0].fcGetType( ) gets NUMBER_Null on TD 3.1 and it gets sometimes 0, sometimes a big number, but the application crashes every try.
Compile and run the example and press "String", "Number" and then "DateTime" and see the result.