Como enumerar un xBrowse

Post Reply
User avatar
acuellar
Posts: 1647
Joined: Tue Oct 28, 2008 6:26 pm
Location: Santa Cruz-Bolivia

Como enumerar un xBrowse

Post by acuellar »

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.
User avatar
jrestojeda
Posts: 601
Joined: Wed Jul 04, 2007 3:51 pm
Location: Buenos Aires - Argentina

Re: Como enumerar un xBrowse

Post by jrestojeda »

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
User avatar
acuellar
Posts: 1647
Joined: Tue Oct 28, 2008 6:26 pm
Location: Santa Cruz-Bolivia

Re: Como enumerar un xBrowse

Post by acuellar »

Si, Esteban

En el momento del Change, se vuelve a incrementar

Gracias

Saludos

Adhemar
Saludos,

Adhemar C.
User avatar
jrestojeda
Posts: 601
Joined: Wed Jul 04, 2007 3:51 pm
Location: Buenos Aires - Argentina

Re: Como enumerar un xBrowse

Post by jrestojeda »

Hola...
Y así?

Code: Select all | Expand

STR(TABLA->OrdKeyNo())


Si tampoco funciona prueba también así:

Code: Select all | Expand

STR( (oBrw:cAlias)->(OrdKeyNo()) )


Saludos,
Ojeda Esteban Eduardo.
Buenos Aires - Argentina.
FWH - PellesC - DBF/CDX - ADS - Gloriosos .Bat - MySql - C# .net - FastReport
Skype: jreduojeda
User avatar
César E. Lozada
Posts: 128
Joined: Wed Oct 26, 2005 12:18 pm
Location: Los Teques, Miranda, Venezuela

Re: Como enumerar un xBrowse

Post by César E. Lozada »

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?
User avatar
nageswaragunupudi
Posts: 10729
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Been thanked: 10 times
Contact:

Re: Como enumerar un xBrowse

Post by nageswaragunupudi »

César E. Lozada wrote:oBrw:aCols[1]:bEditValue:={|| oBrw:KeyNo() }


This is the correct way.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
Posts: 10729
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Been thanked: 10 times
Contact:

Re: Como enumerar un xBrowse

Post by nageswaragunupudi »

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
User avatar
César E. Lozada
Posts: 128
Joined: Wed Oct 26, 2005 12:18 pm
Location: Los Teques, Miranda, Venezuela

Re: Como enumerar un xBrowse

Post by César E. Lozada »

Very good explanation, nageswaragunupudi.

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

Thanks.
User avatar
acuellar
Posts: 1647
Joined: Tue Oct 28, 2008 6:26 pm
Location: Santa Cruz-Bolivia

Re: Como enumerar un xBrowse

Post by acuellar »

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.
User avatar
Daniel Garcia-Gil
Posts: 2365
Joined: Wed Nov 02, 2005 11:46 pm
Location: Isla de Margarita
Contact:

Re: Como enumerar un xBrowse

Post by Daniel Garcia-Gil »

Acuellar


los registros seleccionados estan guardados en el Array ::aSelected
our best documentation is the source code
Isla de Margarita Venezuela.
danielgarciagil@gmail.com
http://tdolphin.blogspot.com/
https://www.dropbox.com/referrals/NTI5N ... rc=global9
User avatar
nageswaragunupudi
Posts: 10729
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Been thanked: 10 times
Contact:

Re: Como enumerar un xBrowse

Post by nageswaragunupudi »

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
User avatar
acuellar
Posts: 1647
Joined: Tue Oct 28, 2008 6:26 pm
Location: Santa Cruz-Bolivia

Re: Como enumerar un xBrowse

Post by acuellar »

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.
User avatar
Daniel Garcia-Gil
Posts: 2365
Joined: Wed Nov 02, 2005 11:46 pm
Location: Isla de Margarita
Contact:

Re: Como enumerar un xBrowse

Post by Daniel Garcia-Gil »

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
our best documentation is the source code
Isla de Margarita Venezuela.
danielgarciagil@gmail.com
http://tdolphin.blogspot.com/
https://www.dropbox.com/referrals/NTI5N ... rc=global9
User avatar
acuellar
Posts: 1647
Joined: Tue Oct 28, 2008 6:26 pm
Location: Santa Cruz-Bolivia

Re: Como enumerar un xBrowse

Post by acuellar »

Gracias Daniel

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

Saludos

Adhemar
Saludos,

Adhemar C.
Post Reply