Columnas dinámicas xbrowse array (Solucionado)

Columnas dinámicas xbrowse array (Solucionado)

Postby leandro » Tue Mar 09, 2021 7:15 pm

Buenas tardes para todos,

En esta ocasión estoy intentando mostrar en un xbrowse columnas de manera dinámica depende de la opción seleccionada. El tema es que al momento de mostrar el contenido dinámico del array se "duplican" los datos. Para ser un poco mas claro monte este ejemplo:

Los valores que se deberian mostrar en la columna dinámica1 serian 15000, no 35000 como ahí aparecen. :oops:

Image

Code: Select all  Expand view

#include "fivewin.ch"
#include "xbrowse.ch"

function Main()

   local oWnd, oBrw, oCol, oFont
   local cNcol, i
   local atales := {}
   local hInfo := {=>}
   local aNnCm := {"dinamica1","dinamica3"}
   
   hInfo["nombre"] := "LEANDRO"
   hInfo["apellido"] := "AREVALO"
   hInfo["id"] := 1 
   hInfo["dinamica1"] := 15000 
   hInfo["dinamica2"] := 25000 
   hInfo["dinamica3"] := 35000 
   hInfo["dinamica4"] := 45000 
   AADD(atales,hInfo)
   hInfo := {=>}

   hInfo["nombre"] := "JUDITH"
   hInfo["apellido"] := "RIVAS"
   hInfo["id"] := 2 
   hInfo["dinamica1"] := 15000 
   hInfo["dinamica2"] := 25000 
   hInfo["dinamica3"] := 35000 
   hInfo["dinamica4"] := 45000 
   AADD(atales,hInfo)
   hInfo := {=>}

   hInfo["nombre"] := "ROBERTO"
   hInfo["apellido"] := "TOTO"
   hInfo["id"] := 3 
   hInfo["dinamica1"] := 15000 
   hInfo["dinamica2"] := 25000 
   hInfo["dinamica3"] := 35000 
   hInfo["dinamica4"] := 45000 
   AADD(atales,hInfo)
   hInfo := {=>}

   hInfo["nombre"] := "FEDERICO"
   hInfo["apellido"] := "EXPLICO"
   hInfo["id"] := 4 
   hInfo["dinamica1"] := 15000 
   hInfo["dinamica2"] := 25000 
   hInfo["dinamica3"] := 35000 
   hInfo["dinamica4"] := 45000 
   AADD(atales,hInfo)
   hInfo := {=>}

   hInfo["nombre"] := "ENTIENDES"
   hInfo["apellido"] := "MEDEZ"
   hInfo["id"] := 5 
   hInfo["dinamica1"] := 15000 
   hInfo["dinamica2"] := 25000 
   hInfo["dinamica3"] := 35000 
   hInfo["dinamica4"] := 45000 
   AADD(atales,hInfo)
   hInfo := {=>}

   Define Font oFont Name "Calibri" Size 0,-12 Bold
   DEFINE WINDOW oWnd TITLE "Columnas Dinamicas"

    SET MESSAGE OF oWnd TO "" 2007

    @ 0,0 XBROWSE oBrw OF oWnd          

    oCol          = oBrw:AddCol()
    oCol:bStrData := {|| if(Len( atales ) > 0 , transform(atales[oBrw:nArrayAt]["id"],"99") ,"" ) }
    oCol:cHeader  = "Id"
    oCol:nWidth   = 20
    oCol:nHeadStrAlign = AL_LEFT
    oCol:nDataStrAlign = AL_LEFT   
    oCol:oHeaderFont = oFont
 
    oCol          = oBrw:AddCol()
    oCol:bStrData := {|| if(Len( atales ) > 0 , atales[oBrw:nArrayAt]["nombre"] ,"" ) }
    oCol:cHeader  = "Nombre"
    oCol:nWidth   = 100
    oCol:nHeadStrAlign = AL_LEFT
    oCol:nDataStrAlign = AL_LEFT   
    oCol:oHeaderFont = oFont

    oCol          = oBrw:AddCol()
    oCol:bStrData := {|| if(Len( atales ) > 0 , atales[oBrw:nArrayAt]["apellido"] ,"" ) }
    oCol:cHeader  = "Apellido"
    oCol:nWidth   = 100
    oCol:nHeadStrAlign = AL_LEFT
    oCol:nDataStrAlign = AL_LEFT   
    oCol:oHeaderFont = oFont
   
    FOR i:=1 TO len(aNnCm)
        cNcol := aNnCm[i] //RECUPERAMOS EL NOMBRE DEL CAMPO EN HASH
        oCol          = oBrw:AddCol()
        oCol:bStrData := {|| if(Len( atales ) > 0 , atales[oBrw:nArrayAt][cNcol] ,"" ) }
        oCol:cHeader  = cNcol
        oCol:nWidth   = 100
        oCol:nHeadStrAlign = AL_RIGHT
        oCol:nDataStrAlign = AL_RIGHT   
        oCol:oHeaderFont = oFont
    NEXT

    oBrw:SetArray( atales ) 
    oBrw:CreateFromCode()   

   oWnd:oClient := oBrw

   ACTIVATE WINDOW oWnd

return nil
 
Last edited by leandro on Wed Mar 24, 2021 11:30 pm, edited 3 times in total.
Saludos
LEANDRO AREVALO
Bogotá (Colombia)
https://hymlyma.com
https://hymplus.com/
leandroalfonso111@gmail.com
leandroalfonso111@hotmail.com

[ Embarcadero C++ 7.60 for Win32 ] [ FiveWin 23.07 ] [ xHarbour 1.3.0 Intl. (SimpLex) (Build 20230914) ]
User avatar
leandro
 
Posts: 1669
Joined: Wed Oct 26, 2005 2:49 pm
Location: Colombia

Re: Columnas dinámicas xbrowse array

Postby Enrico Maria Giordano » Tue Mar 09, 2021 10:23 pm

Try this:


Code: Select all  Expand view
#include "fivewin.ch"
#include "xbrowse.ch"

function Main()

   local oWnd, oBrw, oCol, oFont
   local cNcol, i
   local atales := {}
   local hInfo := {=>}
   local aNnCm := {"dinamica1","dinamica3"}
   
   hInfo["nombre"] := "LEANDRO"
   hInfo["apellido"] := "AREVALO"
   hInfo["id"] := 1
   hInfo["dinamica1"] := 15000
   hInfo["dinamica2"] := 25000
   hInfo["dinamica3"] := 35000
   hInfo["dinamica4"] := 45000
   AADD(atales,hInfo)
   hInfo := {=>}

   hInfo["nombre"] := "JUDITH"
   hInfo["apellido"] := "RIVAS"
   hInfo["id"] := 2
   hInfo["dinamica1"] := 15000
   hInfo["dinamica2"] := 25000
   hInfo["dinamica3"] := 35000
   hInfo["dinamica4"] := 45000
   AADD(atales,hInfo)
   hInfo := {=>}

   hInfo["nombre"] := "ROBERTO"
   hInfo["apellido"] := "TOTO"
   hInfo["id"] := 3
   hInfo["dinamica1"] := 15000
   hInfo["dinamica2"] := 25000
   hInfo["dinamica3"] := 35000
   hInfo["dinamica4"] := 45000
   AADD(atales,hInfo)
   hInfo := {=>}

   hInfo["nombre"] := "FEDERICO"
   hInfo["apellido"] := "EXPLICO"
   hInfo["id"] := 4
   hInfo["dinamica1"] := 15000
   hInfo["dinamica2"] := 25000
   hInfo["dinamica3"] := 35000
   hInfo["dinamica4"] := 45000
   AADD(atales,hInfo)
   hInfo := {=>}

   hInfo["nombre"] := "ENTIENDES"
   hInfo["apellido"] := "MEDEZ"
   hInfo["id"] := 5
   hInfo["dinamica1"] := 15000
   hInfo["dinamica2"] := 25000
   hInfo["dinamica3"] := 35000
   hInfo["dinamica4"] := 45000
   AADD(atales,hInfo)
   hInfo := {=>}

   Define Font oFont Name "Calibri" Size 0,-12 Bold
   DEFINE WINDOW oWnd TITLE "Columnas Dinamicas"

    SET MESSAGE OF oWnd TO "" 2007

    @ 0,0 XBROWSE oBrw OF oWnd          

    oCol          = oBrw:AddCol()
    oCol:bStrData := {|| if(Len( atales ) > 0 , transform(atales[oBrw:nArrayAt]["id"],"99") ,"" ) }
    oCol:cHeader  = "Id"
    oCol:nWidth   = 20
    oCol:nHeadStrAlign = AL_LEFT
    oCol:nDataStrAlign = AL_LEFT  
    oCol:oHeaderFont = oFont
 
    oCol          = oBrw:AddCol()
    oCol:bStrData := {|| if(Len( atales ) > 0 , atales[oBrw:nArrayAt]["nombre"] ,"" ) }
    oCol:cHeader  = "Nombre"
    oCol:nWidth   = 100
    oCol:nHeadStrAlign = AL_LEFT
    oCol:nDataStrAlign = AL_LEFT  
    oCol:oHeaderFont = oFont

    oCol          = oBrw:AddCol()
    oCol:bStrData := {|| if(Len( atales ) > 0 , atales[oBrw:nArrayAt]["apellido"] ,"" ) }
    oCol:cHeader  = "Apellido"
    oCol:nWidth   = 100
    oCol:nHeadStrAlign = AL_LEFT
    oCol:nDataStrAlign = AL_LEFT  
    oCol:oHeaderFont = oFont
   
    FOR i:=1 TO len(aNnCm)
        cNcol := aNnCm[i] //RECUPERAMOS EL NOMBRE DEL CAMPO EN HASH
        oCol          = oBrw:AddCol()
        oCol:bStrData := MKBLK( aTales, oBrw, cNCol )
        oCol:cHeader  = cNcol
        oCol:nWidth   = 100
        oCol:nHeadStrAlign = AL_RIGHT
        oCol:nDataStrAlign = AL_RIGHT  
        oCol:oHeaderFont = oFont
    NEXT

    oBrw:SetArray( atales )
    oBrw:CreateFromCode()  

   oWnd:oClient := oBrw

   ACTIVATE WINDOW oWnd

return nil


STATIC FUNCTION MKBLK( aTales, oBrw, cNCol )

    RETURN { || If( Len( aTales ) > 0, aTales[ oBrw:nArrayAt ][ cNCol ] ,"" ) }


EMG
User avatar
Enrico Maria Giordano
 
Posts: 8707
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: Columnas dinámicas xbrowse array

Postby leandro » Tue Mar 09, 2021 11:24 pm

Enrico muchas gracias
Funciono perfecto :D
Saludos
LEANDRO AREVALO
Bogotá (Colombia)
https://hymlyma.com
https://hymplus.com/
leandroalfonso111@gmail.com
leandroalfonso111@hotmail.com

[ Embarcadero C++ 7.60 for Win32 ] [ FiveWin 23.07 ] [ xHarbour 1.3.0 Intl. (SimpLex) (Build 20230914) ]
User avatar
leandro
 
Posts: 1669
Joined: Wed Oct 26, 2005 2:49 pm
Location: Colombia

Re: Columnas dinámicas xbrowse array (Solucionado)

Postby nageswaragunupudi » Thu Mar 11, 2021 4:11 am

FWH recommends specifying data source and column data within the xbrowse command and to discontinue the very old method of creating the columns using oBrw:AddCol() and oBrw:Set???() methods.

This is a sample program to create the above xbrowse:
Code: Select all  Expand view

#include "fivewin.ch"

function Main()

   local oWnd, oBrw, oFont
   local cNcol, i
   local atales
   local aNnCm := {"dinamica1","dinamica3"}
   local aCols := { "id", "nombre", "apellido" }

   aTales := ReadHashArray()

   Define Font oFont Name "Calibri" Size 0,-12 Bold
   DEFINE WINDOW oWnd TITLE FWVERSION + " : Columnas Dinamicas"
   oWnd:SetFont( oFont )

   SET MESSAGE OF oWnd TO "" 2007

   @ 0,0 XBROWSE oBrw SIZE 0,0 PIXEL OF oWnd ;
      DATASOURCE aTales COLUMNS AMerge( aCols, aNnCm ) ;
      CELL LINES NOBORDER

   AEval( oBrw:aCols, { |o| o:cHeader := TokenUpper( o:cHeader ) } )
   oBrw:CreateFromCode()
   oWnd:oClient := oBrw

   ACTIVATE WINDOW oWnd CENTERED

return nil
 


Image

Function to create the array of hashes:
Code: Select all  Expand view

static function ReadHashArray()

   local hInfo, aTales := {}

   hInfo := {=>}
   hInfo["nombre"] := "LEANDRO"
   hInfo["apellido"] := "AREVALO"
   hInfo["id"] := 1
   hInfo["dinamica1"] := 15000
   hInfo["dinamica2"] := 25000
   hInfo["dinamica3"] := 35000
   hInfo["dinamica4"] := 45000
   AADD(atales,hInfo)
   hInfo := {=>}

   hInfo["nombre"] := "JUDITH"
   hInfo["apellido"] := "RIVAS"
   hInfo["id"] := 2
   hInfo["dinamica1"] := 15000
   hInfo["dinamica2"] := 25000
   hInfo["dinamica3"] := 35000
   hInfo["dinamica4"] := 45000
   AADD(atales,hInfo)
   hInfo := {=>}

   hInfo["nombre"] := "ROBERTO"
   hInfo["apellido"] := "TOTO"
   hInfo["id"] := 3
   hInfo["dinamica1"] := 15000
   hInfo["dinamica2"] := 25000
   hInfo["dinamica3"] := 35000
   hInfo["dinamica4"] := 45000
   AADD(atales,hInfo)
   hInfo := {=>}

   hInfo["nombre"] := "FEDERICO"
   hInfo["apellido"] := "EXPLICO"
   hInfo["id"] := 4
   hInfo["dinamica1"] := 15000
   hInfo["dinamica2"] := 25000
   hInfo["dinamica3"] := 35000
   hInfo["dinamica4"] := 45000
   AADD(atales,hInfo)
   hInfo := {=>}

   hInfo["nombre"] := "ENTIENDES"
   hInfo["apellido"] := "MEDEZ"
   hInfo["id"] := 5
   hInfo["dinamica1"] := 15000
   hInfo["dinamica2"] := 25000
   hInfo["dinamica3"] := 35000
   hInfo["dinamica4"] := 45000
   AADD(atales,hInfo)
   hInfo := {=>}

#ifdef __XHARBOUR__
   AEval( aTales, { |h|    HSetCaseMatch( h, .f. ) } )
#else
   AEval( aTales, { |h| HB_HSetCaseMatch( h, .f. ) } )
#endif

return aTales
 


While we may like to display selected columns in a particular order at start up, we may need to switch the display to different columns in a different order at runtime. While it is possible to achieve this with oCol:Hide(), oCol:Show(), oCol:Move() and oBrw:AddCol(), it is recommended to use the powerful method oBrw:ReArrangeCols()

Syntax:
Code: Select all  Expand view

// FWH2101
oBrw:ReArrangeCols( aCols, [lRetainRest=.t.], [lReNumber=.f.], [lHideRest=.t.] )

// FWH1909
oBrw:ReArrangeCols( aCols, [lRetainRest=.t.], [lReNumber=.f.] )
 


This is a sample dynamically changing the columns and sequence of columns during runtime:

FWH2101:
Code: Select all  Expand view

#include "fivewin.ch"

function Main()

   local oWnd, oBar, oBrw, oFont
   local cNcol, i
   local atales, aCols1, aCols2, aCols3, aCols4

   aTales := ReadHashArray()

   aCols1 := { "id", "nombre", "apellido", "dinamica1", "dinamica3" }
   aCols2 := { "id", "nombre", "apellido", "dinamica2", "dinamica3", "dinamica1" }
   aCols3 := { "id", "nombre", "apellido", "dinamica3", "dinamica2" }
   aCols4 := { "id", "nombre", "dinamica3", "dinamica2","dinamica1", "apellido" }

   Define Font oFont Name "Calibri" Size 0,-14 Bold
   DEFINE WINDOW oWnd TITLE FWVERSION + " : Columnas Dinamicas"
   oWnd:SetFont( oFont )

   DEFINE BUTTONBAR oBar OF oWnd SIZE 50,20 2007
   DEFINE BUTTON OF oBar PROMPT "1,3"   CENTER ACTION oBrw:ReArrangeCols( aCols1 ), oBrw:Refresh()
   DEFINE BUTTON OF oBar PROMPT "2,3,1" CENTER ACTION oBrw:ReArrangeCols( aCols2 ), oBrw:Refresh()
   DEFINE BUTTON OF oBar PROMPT "3,2"   CENTER ACTION oBrw:ReArrangeCols( aCols3 ), oBrw:Refresh()
   DEFINE BUTTON OF oBar PROMPT "MIX"   CENTER ACTION oBrw:ReArrangeCols( aCols4 ), oBrw:Refresh()

   SET MESSAGE OF oWnd TO "" 2007

   @ oBar:nHeight,0 XBROWSE oBrw SIZE 0,0 PIXEL OF oWnd ;
      DATASOURCE aTales AUTOCOLS ;
      CELL LINES NOBORDER

   AEval( oBrw:aCols, { |o| o:cHeader := TokenUpper( o:cHeader ) } )
   oBrw:ReArrangeCols( aCols1 )
   oBrw:CreateFromCode()
   oWnd:oClient := oBrw

   ACTIVATE WINDOW oWnd CENTERED

return nil
 

Image

The method ReArrangeCols() was improved between versions 1909 and 2101. The method works equally well in fwh1909 also but we need to do a little more work. This is the sample that works with FWH1909

FWH1909:
Code: Select all  Expand view

#include "fivewin.ch"

function Main()

   local oWnd, oBar, oBrw, oFont
   local cNcol, i
   local atales, aCols1, aCols2, aCols3, aCols4

   aTales := ReadHashArray()

   aCols1 := { "id", "nombre", "apellido", "dinamica1", "dinamica3" }
   aCols2 := { "id", "nombre", "apellido", "dinamica2", "dinamica3", "dinamica1" }
   aCols3 := { "id", "nombre", "apellido", "dinamica3", "dinamica2" }
   aCols4 := { "id", "nombre", "dinamica3", "dinamica2","dinamica1", "apellido" }

   Define Font oFont Name "Calibri" Size 0,-12 Bold
   DEFINE WINDOW oWnd TITLE FWVERSION + " : Columnas Dinamicas"
   oWnd:SetFont( oFont )

   DEFINE BUTTONBAR oBar OF oWnd SIZE 50,20 2007
   DEFINE BUTTON OF oBar PROMPT "1,3"   CENTER ACTION ReArrangeCols( oBrw, aCols1 )
   DEFINE BUTTON OF oBar PROMPT "2,3,1" CENTER ACTION ReArrangeCols( oBrw, aCols2 )
   DEFINE BUTTON OF oBar PROMPT "3,2"   CENTER ACTION ReArrangeCols( oBrw, aCols3 )
   DEFINE BUTTON OF oBar PROMPT "MIX"   CENTER ACTION ReArrangeCols( oBrw, aCols4 )

   SET MESSAGE OF oWnd TO "" 2007

   @ oBar:nHeight,0 XBROWSE oBrw SIZE 0,0 PIXEL OF oWnd ;
      DATASOURCE aTales AUTOCOLS ;
      CELL LINES NOBORDER

   AEval( oBrw:aCols, { |o| o:cHeader := TokenUpper( o:cHeader ) } )
   ReArrangeCols( oBrw, aCols1 )
   oBrw:CreateFromCode()
   oWnd:oClient := oBrw

   ACTIVATE WINDOW oWnd CENTERED

return nil

static function ReArrangeCols( oBrw, aCols )

   AEval( oBrw:aCols, { |o| o:lHide := .f. } )
   oBrw:ReArrangeCols( aCols )
   AEval( oBrw:aCols, { |o| o:lHide := .t. }, Len( aCols ) + 1 )
   oBrw:Refresh()

return nil
 
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10619
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Columnas dinámicas xbrowse array (Solucionado)

Postby leandro » Fri Mar 12, 2021 8:24 pm

Excelente ejemplo Mr.Rao.

Me voy a tomar el tiempo de implementarlo. Muchísimas gracias por los aportes.
Saludos
LEANDRO AREVALO
Bogotá (Colombia)
https://hymlyma.com
https://hymplus.com/
leandroalfonso111@gmail.com
leandroalfonso111@hotmail.com

[ Embarcadero C++ 7.60 for Win32 ] [ FiveWin 23.07 ] [ xHarbour 1.3.0 Intl. (SimpLex) (Build 20230914) ]
User avatar
leandro
 
Posts: 1669
Joined: Wed Oct 26, 2005 2:49 pm
Location: Colombia

Re: Columnas dinámicas xbrowse array (Solucionado)

Postby leandro » Thu Mar 18, 2021 5:29 pm

Mr.Rao buenas tardes,

Logre implementar lo de las columnas como lo indicaste.

Pero ahora me surge un problema cuando el array se inicia vacio, sale un error, asumo que es al momento de intentar hacer el cambio en las columnas.

Code: Select all  Expand view

#include "fivewin.ch"

function Main()

   local oWnd, oBar, oBrw, oFont
   local cNcol, i
   local atales, aCols1, aCols2, aCols3, aCols4

   aTales := ReadHashArray()

   aCols1 := { "id", "nombre", "apellido", "dinamica1", "dinamica3" }
   aCols2 := { "id", "nombre", "apellido", "dinamica2", "dinamica3", "dinamica1" }
   aCols3 := { "id", "nombre", "apellido", "dinamica3", "dinamica2" }
   aCols4 := { "id", "nombre", "dinamica3", "dinamica2","dinamica1", "apellido" }

   Define Font oFont Name "Calibri" Size 0,-12 Bold
   DEFINE WINDOW oWnd TITLE FWVERSION + " : Columnas Dinamicas"
   oWnd:SetFont( oFont )

   DEFINE BUTTONBAR oBar OF oWnd SIZE 50,20 2007
   DEFINE BUTTON OF oBar PROMPT "1,3"   CENTER ACTION ReArrangeCols( oBrw, aCols1 )
   DEFINE BUTTON OF oBar PROMPT "2,3,1" CENTER ACTION ReArrangeCols( oBrw, aCols2 )
   DEFINE BUTTON OF oBar PROMPT "3,2"   CENTER ACTION ReArrangeCols( oBrw, aCols3 )
   DEFINE BUTTON OF oBar PROMPT "MIX"   CENTER ACTION ReArrangeCols( oBrw, aCols4 )

   SET MESSAGE OF oWnd TO "" 2007

   @ oBar:nHeight,0 XBROWSE oBrw SIZE 0,0 PIXEL OF oWnd ;
      DATASOURCE aTales AUTOCOLS ;
      CELL LINES NOBORDER FOOTERS

   AEval( oBrw:aCols, { |o| o:cHeader := TokenUpper( o:cHeader ) } )
   ReArrangeCols( oBrw, aCols1 )
   oBrw:CreateFromCode()
   oWnd:oClient := oBrw
   
   WITH OBJECT oBrw
      :aCols[2]:cFooter      = "Totales"
      :aCols[2]:bClrStd      = {|| {Rgb(55,55,55),CLR_RED }  }
      :aCols[2]:bClrSelFocus = {|| {CLR_WHITE,CLR_YELLOW }  }
     
     
      FOR i:=4 TO 6
          :aCols[i]:nFooterType  := AGGR_SUM
          :aCols[i]:cFooterPicture := "999,999,999.99"
          :aCols[i]:cEditPicture := "999,999,999.99"
      NEXT
      :MakeTotals()
   END  

   ACTIVATE WINDOW oWnd CENTERED

return nil

function ReArrangeCols( oBrw, aCols )

   AEval( oBrw:aCols, { |o| o:lHide := .f. } )
   oBrw:ReArrangeCols( aCols )
   AEval( oBrw:aCols, { |o| o:lHide := .t. }, Len( aCols ) + 1 )
   oBrw:Refresh()

return nil
 
function ReadHashArray()

   local hInfo, aTales := {}
    hInfo := {=>}
/*
   
   hInfo["nombre"] := "LEANDRO"
   hInfo["apellido"] := "AREVALO"
   hInfo["id"] := 1
   hInfo["dinamica1"] := 15000
   hInfo["dinamica2"] := 25000
   hInfo["dinamica3"] := 35000
   hInfo["dinamica4"] := 45000
   AADD(atales,hInfo)
   hInfo := {=>}

   hInfo["nombre"] := "JUDITH"
   hInfo["apellido"] := "RIVAS"
   hInfo["id"] := 2
   hInfo["dinamica1"] := 15000
   hInfo["dinamica2"] := 25000
   hInfo["dinamica3"] := 35000
   hInfo["dinamica4"] := 45000
   AADD(atales,hInfo)
   hInfo := {=>}

   hInfo["nombre"] := "ROBERTO"
   hInfo["apellido"] := "TOTO"
   hInfo["id"] := 3
   hInfo["dinamica1"] := 15000
   hInfo["dinamica2"] := 25000
   hInfo["dinamica3"] := 35000
   hInfo["dinamica4"] := 45000
   AADD(atales,hInfo)
   hInfo := {=>}

   hInfo["nombre"] := "FEDERICO"
   hInfo["apellido"] := "EXPLICO"
   hInfo["id"] := 4
   hInfo["dinamica1"] := 15000
   hInfo["dinamica2"] := 25000
   hInfo["dinamica3"] := 35000
   hInfo["dinamica4"] := 45000
   AADD(atales,hInfo)
   hInfo := {=>}

   hInfo["nombre"] := "ENTIENDES"
   hInfo["apellido"] := "MEDEZ"
   hInfo["id"] := 5
   hInfo["dinamica1"] := 15000
   hInfo["dinamica2"] := 25000
   hInfo["dinamica3"] := 35000
   hInfo["dinamica4"] := 45000
   AADD(atales,hInfo)
   hInfo := {=>}*/


#ifdef __XHARBOUR__
   AEval( aTales, { |h|    HSetCaseMatch( h, .f. ) } )
#else
   AEval( aTales, { |h| HB_HSetCaseMatch( h, .f. ) } )
#endif

return aTales
 


el error

Code: Select all  Expand view

Application
===========
   Path and name: C:\fwh1909\samples\xbrarray.exe (32 bits)
   Size: 3,864,064 bytes
   Compiler version: xHarbour 1.2.3 Intl. (SimpLex) (Build 20190613)
   FiveWin  version: FWH 19.09
   C compiler version: Borland/Embarcadero C++ 7.3 (32-bit)
   Windows version: 6.2, Build 9200

   Time from start: 0 hours 0 mins 0 secs
   Error occurred at: 03/18/21, 12:23:56
   Error description: Error BASE/1132  Bound error: array access
   Args:
     [   1] = A   { ... } length: 1
     [   2] = N   2

Stack Calls
===========
   Called from: xbrarray.prg => MAIN( 39 )
 
Saludos
LEANDRO AREVALO
Bogotá (Colombia)
https://hymlyma.com
https://hymplus.com/
leandroalfonso111@gmail.com
leandroalfonso111@hotmail.com

[ Embarcadero C++ 7.60 for Win32 ] [ FiveWin 23.07 ] [ xHarbour 1.3.0 Intl. (SimpLex) (Build 20230914) ]
User avatar
leandro
 
Posts: 1669
Joined: Wed Oct 26, 2005 2:49 pm
Location: Colombia

Re: Columnas dinámicas xbrowse array (********)

Postby nageswaragunupudi » Fri Mar 19, 2021 6:07 am

Keep at least one hash in the array while creating xbrowse. Later ON INIT of oDlg, ASize( oBrw:aArrayData, 0 )
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10619
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Columnas dinámicas xbrowse array (********)

Postby leandro » Tue Mar 23, 2021 4:56 pm

Ok, Mr. Nages, muchas gracias.

Voy a probar y comento.
Saludos
LEANDRO AREVALO
Bogotá (Colombia)
https://hymlyma.com
https://hymplus.com/
leandroalfonso111@gmail.com
leandroalfonso111@hotmail.com

[ Embarcadero C++ 7.60 for Win32 ] [ FiveWin 23.07 ] [ xHarbour 1.3.0 Intl. (SimpLex) (Build 20230914) ]
User avatar
leandro
 
Posts: 1669
Joined: Wed Oct 26, 2005 2:49 pm
Location: Colombia

Re: Columnas dinámicas xbrowse array (********)

Postby leandro » Wed Mar 24, 2021 11:30 pm

Ok Mr. Nages.

Fue solucionado como lo sugeriste.

Muchas gracias por la ayuda.
Saludos
LEANDRO AREVALO
Bogotá (Colombia)
https://hymlyma.com
https://hymplus.com/
leandroalfonso111@gmail.com
leandroalfonso111@hotmail.com

[ Embarcadero C++ 7.60 for Win32 ] [ FiveWin 23.07 ] [ xHarbour 1.3.0 Intl. (SimpLex) (Build 20230914) ]
User avatar
leandro
 
Posts: 1669
Joined: Wed Oct 26, 2005 2:49 pm
Location: Colombia


Return to FiveWin para Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 47 guests