Bug with functional classes

Report bugs and possible workarounds for ANSI TD versions
Nils Jänicke
Germany
Posts: 423
Joined: 20 Sep 2017, 11:56
Location: Villingen-Schwenningen, Germany

Bug with functional classes

Post by Nils Jänicke » 02 Nov 2009, 11:39

This bug occurs in many TD versions, also in 5.2 (but already tested in 3.1)

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

Then I have declared functions with receive parameters of arrays:

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
Then I have declared an array of the functional class:

Code: Select all

   Local variables
      FCArray: aa[*]
And then call aa[0].fcSetType( DT_String )
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.
You do not have the required permissions to view the files attached to this post.

Christof
Germany
Posts: 191
Joined: 06 Mar 2017, 07:27
Location: Frankfurt, Germany

Re: Bug with functional classes

Post by Christof » 03 Nov 2009, 08:28

Nils, could you please provide your sample in TD3.1 format?
(Manually downgrading the file by patching the outline version did not work.)

Thanks,
Christof

Nils Jänicke
Germany
Posts: 423
Joined: 20 Sep 2017, 11:56
Location: Villingen-Schwenningen, Germany

Re: Bug with functional classes

Post by Nils Jänicke » 03 Nov 2009, 08:56

Ok, here is it
You do not have the required permissions to view the files attached to this post.

Christof
Germany
Posts: 191
Joined: 06 Mar 2017, 07:27
Location: Frankfurt, Germany

Re: Bug with functional classes

Post by Christof » 03 Nov 2009, 11:02

Hi Nils,

I've just tested your app with TD4.2 and experienced the same behaviour. This actually seems to be a bug.

But, since it is not necessaryto define array- (and UDV-) parameters for functions as "Receive", I've changed the parameter type of appDateFunction from "Receive Date/Time:" to simply "Date/Time". This is working fine, the bug seems to be gone (at least with TD42). Possibly this is working for you, too.

Greetings,
Christof

Return to “Bug Reports (TD 4.2 and older)”

Who is online

Users browsing this forum: No registered users and 1 guest