indexando com descend

Projeto [x]Harbour - Compilador de código aberto compatível com o Clipper.

Moderador: Moderadores

Avatar do usuário
juniorcamilo
Usuário Nível 3
Usuário Nível 3
Mensagens: 343
Registrado em: 10 Nov 2006 09:12
Localização: Pará

indexando com descend

Mensagem por juniorcamilo »

Ola amigos.

estou com um problema de índice usando o descend!
resumindo o código:

Código: Selecionar todos

         if use_arqex5("ARQAUD01","AUDITOR",,"DBFCDX","1") == .f.
            AUD->( __DBpack() )
 	        Ferase('IAUDIT01.CDX')
      	   Index on descend(dtos(DATA)+HORA) tag TAG1 to IAUDIT01
            AUDITOR->(Dbclosearea())
         endif
pelo sistema reorganizo assim e não fica em ordem, mas no dbu32 sim!
segue em anexo o arquivo e o índice gerado por minha aplicação e o índice gerado pelo dbu32!
xharbour 1.2.3!
Anexos
INDDBU.zip
pelo dbu32
(7.17 KiB) Baixado 110 vezes
arqaud.zip.zip
por minha aplicação
(20.73 KiB) Baixado 119 vezes
paiva_dbdc
Usuário Nível 3
Usuário Nível 3
Mensagens: 342
Registrado em: 12 Nov 2012 09:58
Localização: uberlandia mg

indexando com descend

Mensagem por paiva_dbdc »

BOM dia

tente separar descend(dtod... + descend(hora)


uso MUITO o descend (dtos(data)) + outros campos ....

Paiva
Avatar do usuário
juniorcamilo
Usuário Nível 3
Usuário Nível 3
Mensagens: 343
Registrado em: 10 Nov 2006 09:12
Localização: Pará

indexando com descend

Mensagem por juniorcamilo »

paiva_dbdc escreveu: tente separar descend(dtod... + descend(hora)
Paiva
sem sucesso! mesma coisa!
Avatar do usuário
JoséQuintas
Administrador
Administrador
Mensagens: 20267
Registrado em: 26 Fev 2007 11:59
Localização: São Paulo-SP

indexando com descend

Mensagem por JoséQuintas »

Se fosse Windows estariam falando muito mal disso.

Opção 1: Considere bug no Harbour, por manter compatibilidade com Clipper

Opção 2: Considere uso errado

Soluções:

a) use a cláusula DESCEND, NÃO a função Descend():
INDEX ON Dtos(DATA) + HORA DESCEND
Desta forma, nada precisa ser convertido

b) Crie uma função cpDescend() alternativa pra respeitar a codepage
Aonde a opção anterior não puder resolver
José M. C. Quintas
Harbour 3.2, mingw, gtwvg mt, fivewin 25.04, multithread, dbfcdx, MySQL, ADOClass, PDFClass, SefazClass, (hwgui mt), (hmg3), (hmg extended), (oohg), PNotepad, ASP, stored procedure, stored function, Linux (Flagship/harbour 3.2)
"The world is full of kings and queens, who blind our eyes and steal our dreams Its Heaven and Hell"

https://github.com/JoseQuintas/
Avatar do usuário
Itamar M. Lins Jr.
Administrador
Administrador
Mensagens: 7928
Registrado em: 30 Mai 2007 11:31
Localização: Ilheus Bahia
Curtiu: 1 vez

indexando com descend

Mensagem por Itamar M. Lins Jr. »

Olá!
Eu uso assim:

Código: Selecionar todos

   index on dtos(entrada)      tag os06 to servicos.cdx  descending eval {||oBar:Set(,Recno()),.t.}
Saudações,
Itamar M. Lins Jr.
Saudações,
Itamar M. Lins Jr.
Avatar do usuário
juniorcamilo
Usuário Nível 3
Usuário Nível 3
Mensagens: 343
Registrado em: 10 Nov 2006 09:12
Localização: Pará

indexando com descend

Mensagem por juniorcamilo »

Itamar M. Lins Jr. escreveu:Olá!
Eu uso assim:

Código: Selecionar todos

   index on dtos(entrada)      tag os06 to servicos.cdx  descending eval {||oBar:Set(,Recno()),.t.}
Saudações,
Itamar M. Lins Jr.
Obrigado Itamar! funcionou perfeitamente!

testei também a alternativa do Quintas(não funcionou)!
desta forma:
INDEX ON Dtos(DATA) + HORA DESCEND
Avatar do usuário
JoséQuintas
Administrador
Administrador
Mensagens: 20267
Registrado em: 26 Fev 2007 11:59
Localização: São Paulo-SP

indexando com descend

Mensagem por JoséQuintas »

Errei na hora de mostrar.
Mas os CH sempre tiram a dúvida.

ord.ch

Código: Selecionar todos

#ifdef HB_COMPAT_C53

#xtranslate ORDCOND( [FOR <for>]                             ;
                     [<all:ALL>] [WHILE <while>]             ;
                     [EVAL <eval>] [EVERY <every>]           ;
                     [RECORD <rec>] [NEXT <next>]            ;
                     [<rest:REST>] [<descend: DESCENDING>] ) ;
      => ordCondSet( <"for">, <{for}>,                       ;
                     [<.all.>], <{while}>,                   ;
                     <{eval}>, <every>,                      ;
                     RecNo(), <next>, <rec>,                 ;
                     [<.rest.>], [<.descend.>] )

#endif
José M. C. Quintas
Harbour 3.2, mingw, gtwvg mt, fivewin 25.04, multithread, dbfcdx, MySQL, ADOClass, PDFClass, SefazClass, (hwgui mt), (hmg3), (hmg extended), (oohg), PNotepad, ASP, stored procedure, stored function, Linux (Flagship/harbour 3.2)
"The world is full of kings and queens, who blind our eyes and steal our dreams Its Heaven and Hell"

https://github.com/JoseQuintas/
Kapiaba
Colaborador
Colaborador
Mensagens: 1908
Registrado em: 07 Dez 2012 16:14
Localização: São Paulo
Contato:

indexando com descend

Mensagem por Kapiaba »

Código: Selecionar todos

/*
<alias>->( OrdDescend( ,,.T. ) ) //<- DESCENDING
<alias>->( OrdDescend( ,,.F. ) ) //<- sem DESCENDING

*/

EXTERNAL DESCEND

FUNCTION Main()

   FIELD LAST, First

   USE Customer

   INDEX ON Upper( Last + First ) TO Cust01

   GO TOP

   ? LAST               // result: Alberts

   GO BOTTOM

   ? LAST               // result: Waters

   OrdDescend( , , .T. )     // change navigational order

   SKIP - 1                  // skipping backwards from the last

   // record hits begin of file.
   ? Bof()                  // result: .T.

   GO BOTTOM
   ? Eof()                  // result: .F.
   ? LAST               // result: Alberts

   SKIP

   ? Eof()                  // Result: .T.

   GO TOP

   ? LAST               // result: Waters

   BROWSE()

   USE

RETURN NIL

// ISTO NAO FUNCIONA EM XHARBOUR
/*
SET DESCENDING
Change the descending flag of the controlling order

Syntax

      SET DESCENDING ON | OFF | (<lToggle>)
Arguments

ON enables the descending flag.

OFF disables the descending flag.

<lToggle> is a logical expression that must be enclosed in parentheses. A value of true (.T.) is the same as ON, and a value of false (.F.) is the same as OFF.

Note

The initial default of this setting depends on whether the controlling order was created with DESCENDING as an attribute.

Description

SET DESCENDING is functionally equivalent to ORDDESCEND(). Refer to this function for more information.

Examples

      .  The following example illustrates SET DESCENDING.  every order
        can be both ascending and descending:

      USE Customer VIA "DBFCDX"
      INDEX ON LastName TAG Last
      INDEX ON FirstName TAG First DESCENDING

      SET ORDER TO TAG Last
      // last was originally created in ascending order

      // Swap it to descending
      SET DESCENDING ON
      // Last will now be processed in descending order

      SET ORDER TO TAG First
      // First was originally created in descending order

      // Swap it to ascending
      SET DESCENDING OFF
      // First will now be processed in ascending order
Sealso

ORDDESCEND()
*/

om dia, João na tela abaixo queria que a ordem do numero da proposta fosse alterada para decrescente, ou seja que na primeira tela fique sempre o ultimo cadastro feito.

OrdDescend( ,, .T. ) // indice em ordem crescente

OrdDescend( ,, .F. ) // indice em ordem decrescente


      USE Customer VIA "DBFCDX"
      INDEX ON LastName TAG Last
      INDEX ON FirstName TAG First DESCENDING

      SET ORDER TO TAG Last
      // last was originally created in ascending order

      // Swap it to descending
      SET DESCENDING ON
      // Last will now be processed in descending order

      SET ORDER TO TAG First
      // First was originally created in descending order

      // Swap it to ascending
      SET DESCENDING OFF
      // First will now be processed in ascending order

       USE o cliente VIA "DBFCDX"
       INDEX ON LastName TAG Last
       INDEX ON FirstName TAG First DESCENDING

       SET ORDER TO TAG Último
       // last foi originalmente criado em ordem crescente

       // Troque para descendente
       SET DESCENDING ON
       // A última será processada agora em ordem descendente

       SET ORDER TO TAG Primeiro
       // Primeiro foi originalmente criado em ordem decrescente

       // Troque para ascendente
       SET DESCENDING OFF
       // Primeiro será processado em ordem crescente
Responder