[V4RB2] Field.value speed

Frank Schima macsforever2000 at goodeast.com
Tue Mar 29 15:15:27 CST 2005


Hi Kem,


Here's a few things to try:

On Mar 29, 2005, at 1:38 PM, Kem Tekinay wrote:

>   zSortField = zRecSet.Field( me.Heading( column ) )

You might try getting it based on Index instead of name. I'm assuming 
this is not inside any loop?

>   if column < 3 then
>     result = zSortField.Value

Is result a string?

I think you should be casting before you get the Value, otherwise it is 
returning a variant which is slow. So if the Field is a VarChar field 
then:

    result = VVarChar(zSortField).Value

Better yet, if you want a string just do this:

    result = zSortField.GetString

Even better, pass the proper field type from the beginning like so:

     zSortField = zRecSet.VarCharField(x)

Of course zSortField better be the right type.

>   else
>     result = format( zSortField.Value.DoubleValue + 1000 , 
> "000,000.000" )

This is inefficient I think. I'm not even sure what .DoubleValue is. 
But casting is a better way to go here:

     result = format( VDouble(zSortField).Value + 1000 , "000,000.000" )

Again, having a VDouble field already would have been good too.

     zSortField = zRecSet.DoubleField(x)

> // Compensate for negative numbers
>   end if

When filling a Listbox, I pass an entire VCursor so I can cast the 
fields from the start so I can manipulate for display. Using GetString 
for text fields works fine though without casting.


Best regards,
Frank Schima



More information about the Valentina mailing list