FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin para Harbour/xHarbour Como enumerar un xBrowse
Posts: 1710
Joined: Tue Oct 28, 2008 06:26 PM
Como enumerar un xBrowse
Posted: Tue May 11, 2010 08:44 PM

Hola amigos

Cómo hago para enumerar en forma correlativa en una columna de un Browse que muestra una base indexada.

Creí que era fácil con oBrw:nAt() pero siempre me muestra 1

Gracias por la ayuda

Saludos

Adhemar

Saludos,



Adhemar C.
Posts: 601
Joined: Wed Jul 04, 2007 03:51 PM
Re: Como enumerar un xBrowse
Posted: Tue May 11, 2010 10:40 PM

Hola...
Probaste poniendo un simple contador?
Saludos, Esteban.

Ojeda Esteban Eduardo.

Buenos Aires - Argentina.

FWH - PellesC - DBF/CDX - ADS - Gloriosos .Bat - MySql - C# .net - FastReport

Skype: jreduojeda
Posts: 1710
Joined: Tue Oct 28, 2008 06:26 PM
Re: Como enumerar un xBrowse
Posted: Tue May 11, 2010 10:46 PM

Si, Esteban

En el momento del Change, se vuelve a incrementar

Gracias

Saludos

Adhemar

Saludos,



Adhemar C.
Posts: 601
Joined: Wed Jul 04, 2007 03:51 PM
Re: Como enumerar un xBrowse
Posted: Tue May 11, 2010 10:48 PM
Hola...
Y así?

Code (fw): Select all Collapse
STR(TABLA->OrdKeyNo())


Si tampoco funciona prueba también así:

Code (fw): Select all Collapse
 STR( (oBrw:cAlias)->(OrdKeyNo()) )


Saludos,
Ojeda Esteban Eduardo.

Buenos Aires - Argentina.

FWH - PellesC - DBF/CDX - ADS - Gloriosos .Bat - MySql - C# .net - FastReport

Skype: jreduojeda
Posts: 128
Joined: Wed Oct 26, 2005 12:18 PM
Re: Como enumerar un xBrowse
Posted: Wed May 12, 2010 01:03 AM

oBrw:aCols[1]:bEditValue:={|| oBrw:KeyNo() }

Por cierto.... ¿alguien sabe por qué esto no funciona con ADS y si hay alguna manera de hacerlo andar?

Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Como enumerar un xBrowse
Posted: Wed May 12, 2010 01:25 AM
César E. Lozada wrote:oBrw:aCols[1]:bEditValue:={|| oBrw:KeyNo() }


This is the correct way.
Regards



G. N. Rao.

Hyderabad, India
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Como enumerar un xBrowse
Posted: Wed May 12, 2010 01:54 AM
César E. Lozada wrote:
Por cierto.... ¿alguien sabe por qué esto no funciona con ADS y si hay alguna manera de hacerlo andar?


For ADS, XBrowse uses an approximate logic "ADSGetRelKeyPos()/ADSKeyCount()" for tables larger than 200 rows. This approximate logic is good enough for Vertical Scrollbar but not for displaying the indexed row number. XBrowse uses this approximate functions on large tables, because using OreKeyNo() is slow on very large tables.

So it is better to use oCol:bEditValue := { || ( oBrw:cAlias )->( OrdKeyNo() ) }.

Even ADS OrdKeyNo() does not give accurate results in some cases. ADS Server gives the correct number only if the filter used is fully resolved on the server. When we use SET DELETED ON, the OrdKeyNo() includes deleted records also.

If we want OrdKeyNo() to give accurate results we should take the following precasutions:

1. Create an index tag on "DELETED()".
Example: CREATE INDEX ON DELETED() TAG DELETED.
Every filter condition to include "<our condition> .AND. ! DELETED()"
2. Filters should be resolved by the server.
(a) Do not use alias names in filter expressions
(b) Use constants, not variables in filter expressions.
Instead of "CUSTNAME = cName", use "CUSTNAME = '" + cName + "'"
Regards



G. N. Rao.

Hyderabad, India
Posts: 128
Joined: Wed Oct 26, 2005 12:18 PM
Re: Como enumerar un xBrowse
Posted: Wed May 12, 2010 02:30 AM

Very good explanation, nageswaragunupudi.

A day isn't full if we don't learn something new!

Thanks.

Posts: 1710
Joined: Tue Oct 28, 2008 06:26 PM
Re: Como enumerar un xBrowse
Posted: Wed May 12, 2010 01:02 PM

Gracias Distinguidos

Funciona con OrdKeyNo() y con oBrw:KeyNo(), hay que tomar en cuenta lo indica Nages.. que hay que indexar con DELETE() ya que lo toma en cuenta.
Ahora puedo elegir desde hasta.

Se que con oBrw:nMarqueeStyle = MARQSTYLE_HIGHLROWMS se puede seleccionar con SHIFT Y CTRL y los guarda en oBrw:aSelected.
Como obtengo los seleccionados?

Gracias por la ayuda

Saludos

Adhemar

Saludos,



Adhemar C.
Posts: 2365
Joined: Wed Nov 02, 2005 11:46 PM
Re: Como enumerar un xBrowse
Posted: Wed May 12, 2010 01:33 PM

Acuellar

los registros seleccionados estan guardados en el Array ::aSelected

Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Como enumerar un xBrowse
Posted: Wed May 12, 2010 01:34 PM
Se que con oBrw:nMarqueeStyle = MARQSTYLE_HIGHLROWMS se puede seleccionar con SHIFT Y CTRL y los guarda en oBrw:aSelected.
Como obtengo los seleccionados?

I am not sure if I understand the question correctly. oBrw:aSelected is an Array of RecNo()s ( not OrdKeyNo()s )
Regards



G. N. Rao.

Hyderabad, India
Posts: 1710
Joined: Tue Oct 28, 2008 06:26 PM
Re: Como enumerar un xBrowse
Posted: Wed May 12, 2010 08:00 PM

Distinguidos

En la tabla aSelected es unidimensional logro leer el primer registro, como se hace para leer los siguientes seleccionados

nPos:=oBrw_aSelected[1]

he colocado nPos:=oBrw_aSelected[1,1] y da error

Gracias por la ayuda

Saludos

Adhemar

Saludos,



Adhemar C.
Posts: 2365
Joined: Wed Nov 02, 2005 11:46 PM
Re: Como enumerar un xBrowse
Posted: Wed May 12, 2010 08:25 PM

Acuellar

tu lo has dicho, es unidimensional, lo recorres uno por uno

aSelected[ 1 ], aLelected[ 2 ], aSelected[ 3 ], ... aSelected[ n ]

aSelected es llenado con los RecNo()s

Posts: 1710
Joined: Tue Oct 28, 2008 06:26 PM
Re: Como enumerar un xBrowse
Posted: Wed May 12, 2010 08:40 PM

Gracias Daniel

Mi error era colocar [1] en ves de [ 1 ]

Saludos

Adhemar

Saludos,



Adhemar C.

Continue the discussion