Ordem decrescente
Enviado: 25 Jun 2016 20:18
É sério, até confirmei no Clipper 5.2 pra ver se era verdade.
Isto é novidade pra mim:
É mais eficiente do que usar a função Descend()
E isto:
Antes eu usava Descend( Dtos( DateField )) ), o que gera problemas ao usar codepage, e até criei CPDescend()
Descend() direto na data retorna um numérico, pra uso em ordem decrescente.
Não sei se pra mais alguém vai ser novidade.
Nota: Lógico, também vale no Harbour.
Isto é novidade pra mim:
É mais eficiente do que usar a função Descend()
Código: Selecionar todos
INDEX ON Codigo TO temp DESCENDINGCódigo: Selecionar todos
INDEX ON Descend( DateField ) TO temp
INDEX ON Codigo + Str( Descend( DateField ), 7 ) TO tempDescend() direto na data retorna um numérico, pra uso em ordem decrescente.
Fica aí a dica, que pra mim é novidade, mesmo existindo há mais de 20 anos, no Clipper 5.2.Clipper 5.2 NG:
Returns DESCEND() returns an inverted expression of the same data type as the <exp>, except for dates which return a numeric value. A DESCEND() of CHR(0) always returns CHR(0).
Notes . The preferred way to create a descending index is to use the DESCENDing clause of the INDEX command. Using DESCENDING is the same as specifying the DESCEND() function, but without the performance penalty during index updates. If you create a DESCENDING index, you won't need to use the DESCEND() function during a SEEK. DESCENDING is an attribute of the (.ntx) file, where it is stored and used for REINDEXing purposes.
Não sei se pra mais alguém vai ser novidade.
Nota: Lógico, também vale no Harbour.