XBROWSE Y TABLA ADT

Post Reply
User avatar
GUSPRE
Posts: 92
Joined: Thu May 11, 2006 10:00 pm
Location: BS.AS.ARGENTINA
Contact:

XBROWSE Y TABLA ADT

Post by GUSPRE »

Estimado Antonio,

Estamos mudando los antiguos WBROWSE a XBROWSE de FWH 8.12 y XHARBOUR, usamos tablas ADT pero no pudimo hacer andar el XBROWSE el mini codigo a continuación funciona perfecto con tablas DBF pero tira el error mas abajo cuando mostramos una tabla ADT, podrías darnos una mano con esto,

Código de Prueba,

Code: Select all

USE TABLA1 NEW SHARED ALIAS GUSTAVO VIA "ADT"

SELECT GUSTAVO

BROWSE()


DEFINE WINDOW oWSal MDIChild OF oWnd;
       TITLE "Salidas"

			 ** Controles ******

			 DEFINE BUTTONBAR oBar 3DLOOK BUTTONSIZE 34,34 OF oWSal 2007

			 DEFINE BUTTON oBto1 ;
              OF oBar ;
              RESOURCE "B_NUEVO" ;
              TOOLTIP "Nueva Salida"   ;
              NOBORDER

   		 @ 0,0 XBROWSE oBrw;
      	 OF oWnd ;
      	 ALIAS "GUSTAVO" AUTOCOLS

         oBrw:CreateFromCode()

oWsal:oClient := oBrw


ACTIVATE WINDOW oWSal;
				 VALID  (oWSal:=Nil,.T.)

El error es el siguiente en XBRWOSE

Application
===========
Path and name: C:\CONTROLV\controlv.exe (32 bits)
Size: 1,937,920 bytes
Time from start: 0 hours 0 mins 4 secs
Error occurred at: 01/30/09, 18:08:24
Error description: Error BASE/1111 Argument error: LEN
Args:
[ 1] = U

Stack Calls
===========
Called from: => LEN(0)
Called from: XBROWSE.prg => SETCOLFROMRDD(5121)
Called from: XBROWSE.prg => TXBROWSE:SETRDD(3194)
Called from: XBROWSE.prg => XBRWSETDATASOURCE(7922)
Called from: XBROWSE.prg => XBROWSENEW(7800)
Called from: controlv.PRG => CON_SALIDAS(254)
Called from: controlv.PRG => (b)BUILDMENU(114)
Called from: .\source\classes\MENU.PRG => TMENU:COMMAND(0)
Called from: .\source\classes\WINDOW.PRG => TWINDOW:COMMAND(0)
Called from: .\source\classes\MDIFRAME.PRG => TMDIFRAME:COMMAND(0)
Called from: => TMDIFRAME:HANDLEEVENT(0)
Called from: .\source\classes\WINDOW.PRG => _FWH(0)
Called from: => WINRUN(0)
Called from: .\source\classes\WINDOW.PRG => TMDIFRAME:ACTIVATE(0)
Called from: controlv.PRG => MAIN(85)

Desde ya Gracias por tu ayuda,

Saludos,
GUSTAVO PREDIGER
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: XBROWSE Y TABLA ADT

Post by Antonio Linares »

Gustavo,

La función SETCOLFROMRDD() se modificó para no llamar a Len(). Este es el código a usar (reemplázalo en xbrowse.prg):

Code: Select all

static function SetColFromRDD( oCol, nFld, cAlias, aFldInfo, lAutoSort )

   local cName       // if fieldname is specified in different case, header is set accordingly
   local nLen, nDec, nSelect  := SELECT( cAlias )

   if valtype( nFld ) == 'C'
      nFld  := (cAlias)->(FieldPos(cName := nFld))

   endif

   aFldInfo          := aFldInfo[ nFld ]

   oCol:cHeader      := If( cName == nil, aFldInfo[ 1 ], cName )
   if ( cName == nil )
      cName          := aFldInfo[ 1 ]
   endif

//   oCol:bEditValue   := FieldWBlock( cName, nSelect )
   oCol:bEditValue   := { |x| If( x == nil, ( oCol:oBrw:cAlias )->( FieldGet( nFld ) ), ;
                                ( oCol:oBrw:cAlias )->( FieldPut( nFld, x ) ) ) }

   nLen              := aFldInfo[ 3 ]
   nDec              := aFldInfo[ 4 ]

   if Len( aFldInfo[ 2 ] ) == 1
      oCol:cDataType      := aFldInfo[ 2 ]
      if oCol:cDataType == "I"
         oCol:cDataType := 'N'
         if aFldInfo[ 3 ] == 2
            nLen        := 6
         else
            nLen        := 13
         endif
         nDec           := 0
      elseif oCol:cDataType == 'Y'
         oCol:cDataType := 'N'
         nLen           := 15
         nDec           := 2
      elseif oCol:cDataType == "U"
         oCol:cDataType := 'C'
      endif
   else
      // ADT table
      oCol:cDataType    := ValType( ( cAlias )->( FieldGet( nFld ) ) )
      do case
         case oCol:cDataType == 'N'
            do case
               case "DOUBLE" $ aFldInfo[ 2 ] .or. "MONEY" $ aFldInfo[ 2 ]
                  nLen           := 15
                  nDec           := 2
               case AScan( { "AUTOINC", "ROWVERSION" }, aFldInfo[ 2 ] ) > 0
                  nLen           := 15
                  nDec           := 0
               otherwise
                  nLen           := 15
                  nDec           := 0
            endcase
#ifdef __XHARBOUR__
         case oCol:cDataType == 'D'
            if 'TIME' $ aFldInfo[ 2 ]
               oCol:cDataType    := 'T'
               oCol:cEditPicture := '@T'
            endif
#endif
         case oCol:cDataType $ "CM"
            if aFldInfo[ 2 ] = "IMAGE"
               oCol:bStrData     := { || "<Image>" }
            elseif aFldInfo[ 2 ] = "RAW"
               oCol:bStrData     := { || "<Binary>" }
            endif
         otherwise
            // nothing to do
      endcase
   endif

   // oCol:adjust() will set bstrdata

   do case
   case oCol:cDataType == 'N'
      oCol:cEditPicture   := NumPict( nLen, nDec, .T., lThouSep )
   case oCol:cDataType  == 'D'
      oCol:cEditPicture   := '@D'
#ifdef __XHARBOUR__
      if hb_IsDateTime( (cAlias)->( FieldGet( nFld ) ) )
//         oCol:bStrData     := { || TTOC( (cAlias)->( FieldGet( nFld ) ) ) }
         oCol:cEditPicture := '@T'
      endif
#endif
   endcase

   oCol:bOnPostEdit  := { |o,x,n| If( n != VK_ESCAPE .and. Eval( o:oBrw:bLock ), ;
          (Eval( o:bEditValue, x ), o:oBrw:lEdited := .t. ), ) }

   if lAutoSort
      if (cAlias)->( OrdNumber( oCol:cHeader ) ) > 0
         oCol:cSortOrder   := oCol:cHeader
      endif
   endif

return oCol
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
GUSPRE
Posts: 92
Joined: Thu May 11, 2006 10:00 pm
Location: BS.AS.ARGENTINA
Contact:

Re: XBROWSE Y TABLA ADT

Post by GUSPRE »

Gracias Antonio lo probaremos el problema se daba en las tablas ADT en campos, propios de ADT que no reconocia.-

Saludos,
GUSTAVO PREDIGER
Post Reply