Page 1 of 1

Possible, to get a real VALTYPE-Info from inside xBrowse ?

Posted: Sat Mar 01, 2008 12:49 am
by ukoenig
Hello

There is a problem i have in xBROWSE :

For some reasons, i have to get the VAL-TYPE of a database.
No cols are defined.
When I do :
msgalert( VALTYPE( FIELDNAME( nOrder )) )
in a for next loop, the message returns allways < C >
maybe because of the functions in the xBROWSE-Class


Sample :

Code: Select all


for nFor := 1 to Fcount()
      oBrw5:aCols[ nFor ]:bRClickHeader := ;
      {|r,c,f,o| cFELD := o:cHeader, ;            // = oCol:cHeader
        nOrder := o:nCreationOrder, ;            // = Header-Click-Col 
       msgalert( VALTYPE( FIELDNAME( nOrder )) ), ; // all Fields are  C 
       oBrw5:Refresh(), ;
       oBrw5:SwapCols( 1, nOrder ), ;          // Bring selected col to 1
       oBrw5:GoLeftMost(), ;                        // Go to 1. Col ( indexed )
       oBrw5:nFreeze := 1 }                        // Freeze 1. Col
next


cValToChar !!!!!
// -------------------
//----------------------------------------------------------------------------//

STATIC FUNCTION AdoGenFldBlk(oRs,nField)
RETURN {|| cValToChar( oRs:Fields(nField):Value) }

//----------------------------------------------------------------------------//

STATIC FUNCTION GenFieldBlock( cAlias, nField )

RETURN {|| cValToChar( ( cAlias )->( FieldGet( nField ) ) ) }

//----------------------------------------------------------------------------//

STATIC FUNCTION GenArrayBlock( bBlock, nCol, lAsString )

   local block

   if lAsString
      block :=  {|| cValToChar( Eval( bBlock )[ nCol ] ) }
   else
      block :=  {|| Eval( bBlock )[ nCol ] }
   endif

RETURN block

How can i findout the correct VAL-Type of a field,
inside of a xBrowse ?

Regard
Uwe :lol:

Posted: Sat Mar 01, 2008 10:07 am
by Detlef Hoefner
Uwe,

i don't know much about xBrowse.
But
msgalert( VALTYPE( FIELDNAME( nOrder )) ), ; // all Fields are C
The function fieldname will return the name of a field which is indeed always of valtype 'C'.

Maybe you should ask for

Code: Select all

valtype( fieldget( nOrder ) )
hth,
Detlef

VALTYPE in xBrowse

Posted: Sat Mar 01, 2008 12:31 pm
by ukoenig
Hello Detlef,

It is true, it was just the wrong call
VALTYPE( Fieldget( nOrder ) ) returns the
correct value.
It seems, after working till late at night,
i loosing a bit the concentration.

Thanks
Regards
Uwe