jfaguiar Posted June 15, 2016 Report Share Posted June 15, 2016 Boa tarde amigos. Tem como utilizar o comando between em FW? Exemplo: SET FILTER TO CODIGO BETWEEN(1 , 50 ) Obrigado Quote Link to comment Share on other sites More sharing options...
kapiaba Posted June 15, 2016 Report Share Posted June 15, 2016 De que linguagem é esse BETWEEN? E o que ele faria nesse filtro? Eu acho que você deve usar o FOR... ou WHILE... mas... IF CADPARAM->TPAMB = [1] SET FILTER TO ( .NOT. EOF() ) .AND. ; CADNFE->NFECOD >= NNOTAINI .AND. ; // alterado 31/08/2009 CADNFE->NFECOD <= NNOTAFIN .AND. ; CADNFE->STATUS = "IMP" .AND. ; CADNFE->TPFAT_OP = "P" .AND. ; CADNFE->PROTOCOLO != [ ] ELSE SET FILTER TO ( .NOT. EOF() ) .AND. ; CADNFE->FATURCOD >= NNOTAINI .AND. ; CADNFE->FATURCOD <= NNOTAFIN .AND. ; CADNFE->STATUS = "IMP" .AND. ; CADNFE->TPFAT_OP = "P" ENDIF Quote Link to comment Share on other sites More sharing options...
fladimir Posted June 15, 2016 Report Share Posted June 15, 2016 BETWEEN tem em SQL, talvez outras linguagens... agora em Harbour desconheço se bem q da pra fazer um #translate Quote Link to comment Share on other sites More sharing options...
Theotokos Posted June 15, 2016 Report Share Posted June 15, 2016 O operador BETWEEN é usada para seleccionar valores dentro de um intervalo. Set Filter to CODIGO >= 1 .And. CODIGO <= 50 mas conforme o Kapiaba falou se for possível no seu codigo, utilize FOR ou WHILE vai ficar mais rapido a rotina Quote Link to comment Share on other sites More sharing options...
jfaguiar Posted June 16, 2016 Author Report Share Posted June 16, 2016 Obrigado amigos. Quote Link to comment Share on other sites More sharing options...
toya Posted June 16, 2016 Report Share Posted June 16, 2016 #xtranslate BETWEEN( <x>,<y>,<z> ) => ; (if(<x>\>=<y>.and.<x>\<=<z>, .t.,.f. )) kapiaba and Theotokos 2 Quote Link to comment Share on other sites More sharing options...
rochinha Posted June 16, 2016 Report Share Posted June 16, 2016 Amiguinhos, Baseado na postagem do amigo toya, vejamos: #INCLUDE "FIVEWIN.CH" #command SET FILTER TO <x> BETWEEN <y>,<z> SCOPED ; => OrdScope( 0, <y> ) ; ; OrdScope( 1, <z> ) FUNCTION MAIN REQUEST DBFCDX RDDRegister('DBFCDX',1) RDDSetDefault('DBFCDX') // Indexado pelo campo IDCLIENTE por STR(IDCLIENTE,5,0) USE CLIENTES EXCLUSIVE INDEX CLIENTES SET FILTER TO SET ORDER TO 2 // Ordem pelo campo IDCLIENTE SET FILTER TO IDCLIENTE BETWEEN STR(15,5,0), " 30" SCOPED BROWSE() RETURN O fato de usar o RDDCDX já implica em alta performance no que tange a velocidade de filtragem e composição. Já no tradicional SET FILTER a perda de tempo em relação as filtragens é percepitível. kapiaba 1 Quote Link to comment Share on other sites More sharing options...
rochinha Posted June 16, 2016 Report Share Posted June 16, 2016 Amiguinhos,Aqui nesta implementação uso somente o SET FILTER TO expressãoA implementação ficou horrível, mas funciona. Quem puder melhorar, por favor... #INCLUDE "FIVEWIN.CH" #command SET FILTER TO BETWEEN , => ; dbSetFilter( {||\>=.and.\<=} , <"x">+">="+<"y">+".and."+<"x">+"<="+<"z"> ) FUNCTION MAIN REQUEST DBFCDX RDDRegister('DBFCDX',1) RDDSetDefault('DBFCDX') USE CLIENTES EXCLUSIVE // Padrão normal SET FILTER TO SET FILTER TO IDCLIENTE >= 11 .And. IDCLIENTE <= 15 BROWSE() // Padrão definido pelo usuário SET FILTER TO SET FILTER TO IDCLIENTE BETWEEN 11, 30 BROWSE() RETURN Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.