[RESUELTO] Accent Insensitive no access?
#1
Posted 06 January 2011 - 04:51 AM
Gracias.
#2
Posted 06 January 2011 - 06:30 AM
No entiendo nada lo que andas buscando.
Alguna función Acento Incentivos para Delphi o alguna BD?
#3
Posted 06 January 2011 - 06:37 AM
Si busco acento Incencitive no MS-ACCESSSaludos.
No entiendo nada lo que andas buscando.
Alguna función Acento Incentivos para Delphi o alguna BD?
Deves ignorar acentos en filter, exists uma manera?
Lo sentimos que he publicado en el foro error.
#4
Posted 06 January 2011 - 07:08 AM
Que yo sepa no existe pero tampoco se necesita.
Saludos
#5
Posted 06 January 2011 - 07:14 AM
necesito que el sistema de filtro para ignorar las palabras con acentos.Hola
Que yo sepa no existe pero tampoco se necesita.
Saludos
Ex: PARANÁ --> No ACCESS no filter o Á, i necesito que filter o Á tambien.
SÃO PAULO --> No ACCESS no filter Ã, i necesito que filter tambien.
Gracias.
#6
Posted 06 January 2011 - 09:27 AM
Saludos
#7
Posted 06 January 2011 - 09:34 AM
{******************************************************} {* Description: Implementation of Soundex function *} {******************************************************} {* Last Modified : 12-Nov-2000 *} {* Author : Paramjeet Singh Reen *} {* eMail : Paramjeet.Reen@EudoraMail.com *} {******************************************************} {* This program is based on the algorithm that I had *} {* found in a magazine. I do not gurantee the fitness *} {* of this program. Please use it at your own risk. *} {******************************************************} {* Category :Freeware. *} {******************************************************} unit Soundx; interface type SoundexStr = String[4]; //Returns the Soundex code for the specified string. function Soundex(const InpStr :ShortString):SoundexStr; implementation const Alphs :array['A'..'Z'] of Char = ('0','1','2','3','0','1','2','0','0','2','2', '4','5','5','0','1','2','6','2','3','0','1', '0','2','0','2'); function Soundex(const InpStr :ShortString) :SoundexStr; var vStr :ShortString; vCh1 :Char; i :Word; begin //Store the given InpStr in local variable in uppercase vStr := ''; for i := 1 to Length(InpStr) do vStr := vStr + UpCase(InpStr[i]); //Replace all occurances of "PH" with "F" i := Pos('PH',vStr); while(i > 0) do begin Delete(vStr,i,2); Insert('F',vStr,i); i := Pos('PH',vStr); end; //Replace all occurances of "CHR" with "CR" i := Pos('CHR',vStr); while(i > 0) do begin Delete(vStr,i,3); Insert('CR',vStr,i); i := Pos('CHR',vStr); end; //Replace all occurances of "Z" with "S" for i := 1 to Length(vStr) do if(vStr[i] = 'Z') then vStr[i] := 'S'; //Replace all occurances of "X" with "KS" i := Pos('X',vStr); while(i > 0) do begin Delete(vStr,i,1); Insert('KS',vStr,i); i := Pos('X',vStr); end; //Remove all adjacent duplicates i := 2; while(i <= Length(vStr))do if(vStr[i] = vStr[i-1]) then Delete(vStr,i,1) else Inc(i); //Starting from 2nd char, remove all chars mapped to '0' in Alphs table i := 2; while(i <= Length(vStr))do if(Alphs[vStr[i]] = '0') then Delete(vStr,i,1) else Inc(i); //Assemble Soundex string from Alphs table vCh1 := vStr[1]; for i := 1 to Length(vStr) do vStr[i] := Alphs[vStr[i]]; //Remove all adjacent duplicates from assembled Soundex string i := 2; while(i <= Length(vStr))do if(vStr[i] = vStr[i-1]) then Delete(vStr,i,1) else Inc(i); //Final assembly of Soundex string vStr := vCh1 + Copy(vStr,2,255); for i := Length(vStr) to 3 do vStr := vStr + '0'; Soundex := vStr; end; end.
Desconozco del tema pero esta interesante, espero y este orientado a tu cuestionamiento.
La ventaja de este código podría ser: incorporarlo a tu aplicación cliente o bien a un motor de base de datos que te permita definir funciones.
Saludos.
#8
Posted 06 January 2011 - 09:49 AM
SELECT * FROM tabla WHERE campo BETWEEN 'palabra' AND 'palabraZ' AND campo LIKE '???????'
#9
Posted 06 January 2011 - 11:22 AM
No entendi esta sintaxe
SELECT * FROM tabla WHERE campo BETWEEN 'palabra' AND 'palabraZ' AND campo LIKE '???????'
#10
Posted 06 January 2011 - 11:55 AM
gracias Pessoal...
No entendi esta sintaxe
sql
SELECT * FROM tabla WHERE campo BETWEEN 'palabra' AND 'palabraZ' AND campo LIKE '???????'
Revisa el adjunto.
Saludos
#11
Posted 06 January 2011 - 01:10 PM
select campo from tabla where nombre_del_campo_en_en_donde_buscaras_ej_nombre like '"'+edit1.text+'"';
eso es si quieres que sean todos los campos que tengan algo parecido o tenga las letras que busca en otra cosa usa este que solo filtra un nombre en especifico.
select campo from tabla where nombre_del_campo_en_en_donde_buscaras_ej_nombre = '"'+edit1.text+'"';
el edit puedes cambiarlo por algo estático si es que quieres buscar algo directo o bien si usas un edit para el buscador pones el nombre de ese edit con su propiedad text,espero que te sirva. si no lo que te sugiero es que crees una funcion que sustituya esos caracteres por los normales por ejemplo la función
procedure TForm1.Button1Click(Sender: TObject); var a:string; begin a:=StringReplace(edit1.Text, 'ñ', 'n', [rfReplaceAll, rfIgnoreCase]); edit1.Text := a; showmessage(a); end;
esta función sustituye las ñ que que escribes en el edit por n, si deseas que seas por otras solo tienes que adaptarla y puedes usarla las veces que sea necesario.
#12
Posted 07 January 2011 - 08:12 AM
Al ver los códigos de postados ... intentado hacer assí
unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, DB, ADODB, Grids, DBGrids, StdCtrls; type TForm1 = class(TForm) DBGrid1: TDBGrid; DataSource1: TDataSource; Button1: TButton; ADOConnection1: TADOConnection; ADOQuery1: TADOQuery; EdiPesquisa: TEdit; procedure Button1Click(Sender: TObject); private { Private declarations } public { Public declarations } end; var Form1: TForm1; implementation {$R *.dfm} function Tiraacento(Str: string): string; const ComAcento = 'àâêôûãõáéíóúçüÀÂÊÔÛÃÕÁÉÍÓÚÇÜ'; SemAcento = 'aaeouaoaeioucuAAEOUAOAEIOUCU'; var x: Integer; begin; for x := 1 to Length(Str) do if Pos(Str[x],ComAcento) <> 0 then Str[x] := SemAcento[Pos(Str[x], ComAcento)]; Result := Str; end; function ColocaAcento(str: String): String; const ComAcento = 'àâêôûãõáéíóúçüÀÂÊÔÛÃÕÁÉÍÓÚÇÜ'; SemAcento = 'aaeouaoaeioucuAAEOUAOAEIOUCU'; var x: Integer; begin; for x := 1 to Length(Str) do if Pos(Str[x],SemAcento) <> 0 then Str[x] := ComAcento[Pos(Str[x], SemAcento)]; Result := Str; end; procedure TForm1.Button1Click(Sender: TObject); begin ADOQuery1.Close; ADOQuery1.SQL.Clear; ADOQuery1.SQL.Add('Select * From crdUf WHERE crdUf.descricao LIKE ''%' + Tiraacento(EdiPesquisa.Text) + '%'' OR crdUf.descricao LIKE ''%' + ColocaAcento(EdiPesquisa.Text) + '%'' OR crdUf.descricao LIKE ''%' + EdiPesquisa.Text + '%'''); ADOQuery1.Open; end; end.
Más no funcionó correctamente. Alguna sugerencia? Saludos
#13
Posted 07 January 2011 - 08:41 AM
¿ Ya revisaste el ejemplo de cHackAll ? A mi me parece que es lo que necesitas.
Salud OS
#14
Posted 07 January 2011 - 10:45 AM
Segue...
Tiene que ver esto en Edit?
Tengo palabras NO MDB
PARÁ
PARANÁ
PARAÍBA
SÃO PAULO
....
I no pued hacer no excemplo.
procedure TForm1.Button2Click(Sender: TObject); begin FillList('SELECT * FROM tabla WHERE (campo BETWEEN ''para'' AND ''paranaZ'') AND (campo LIKE ''_____'')'); end;
No filter assí como fiz.
Saludos
#15
Posted 07 January 2011 - 11:59 AM
procedure TForm1.Edit1Change(Sender: TObject); var i: Integer; str: string; begin str := ''; for i := 1 to Length(Edit1.Text) do str := str + '_'; FillList('SELECT * FROM tabla WHERE (campo BETWEEN ''' + Edit1.Text + ''' AND ''' + Edit1.Text + 'Z'') AND (campo LIKE ''' + str + ''')'); end;
#16
Posted 07 January 2011 - 12:16 PM
Result final
procedure TForm1.EdiPesquisaChange(Sender: TObject); var i: Integer; str: String; begin str := EmptyStr; for i := 1 to Length(EdiPesquisa.Text) do str := str + '_'; if EdiPesquisa.Text <> EmptyStr then begin ADOQuery1.Close; ADOQuery1.SQL.Clear; ADOQuery1.SQL.Add('Select * From crdUf WHERE (crdUf.descricao BETWEEN :BUSCA_INI AND :BUSCA_FIN) '); ADOQuery1.SQL.Add(' AND (crdUf.descricao LIKE :LIMITESPACO) '); ADOQuery1.Parameters.ParamByName('BUSCA_INI').Value := EdiPesquisa.Text; ADOQuery1.Parameters.ParamByName('BUSCA_FIN').Value := EdiPesquisa.Text + 'Z'; ADOQuery1.Parameters.ParamByName('LIMITESPACO').Value := str +'%'; //Acrescentei o CURINGA para tazer todos na list ADOQuery1.Open; end else begin ADOQuery1.Close; ADOQuery1.SQL.Clear; ADOQuery1.SQL.Add('Select * From crdUf '); ADOQuery1.Open; end; end;
#17
Posted 07 January 2011 - 01:09 PM
AMAPÁ
y
AMAZONAS
No Edit escrevo : AMA
return in grid
AMAPÁ
No apareció
AMAZONAS
#18
Posted 07 January 2011 - 01:37 PM
No hay manera de utilizar el comodín de la variable?
Exemplo:
unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, DB, ADODB, Grids, DBGrids, StdCtrls, Tabs, ExtCtrls, ComCtrls, Buttons, XPMan; type TForm1 = class(TForm) DBGrid1: TDBGrid; DataSource1: TDataSource; ADOConnection1: TADOConnection; ADOQuery1: TADOQuery; pnlFiltro: TPanel; lblFiltrar: TLabel; bttFiltrar: TButton; EdtPesquisa: TEdit; pButton: TPanel; SpeedButton1: TSpeedButton; SpeedButton2: TSpeedButton; SpeedButton3: TSpeedButton; SpeedButton4: TSpeedButton; SpeedButton5: TSpeedButton; SpeedButton6: TSpeedButton; SpeedButton7: TSpeedButton; SpeedButton8: TSpeedButton; SpeedButton9: TSpeedButton; SpeedButton10: TSpeedButton; SpeedButton11: TSpeedButton; SpeedButton12: TSpeedButton; SpeedButton13: TSpeedButton; SpeedButton14: TSpeedButton; StatusBar1: TStatusBar; procedure EdtPesquisaChange(Sender: TObject); procedure bttFiltrarClick(Sender: TObject); private procedure AccessInsensitive(qQuery: TADOQuery; sEdtPesquisa: TEdit; TipoFilter: Integer); { Private declarations } public { Public declarations } end; var Form1: TForm1; implementation {$R *.dfm} procedure TForm1.AccessInsensitive(qQuery: TADOQuery; sEdtPesquisa: TEdit; TipoFilter: Integer); var i: Integer; str: String; begin str := EmptyStr; for i := 1 to Length(sEdtPesquisa.Text) do str := str + '_'; if TipoFilter = 0 then // Então o filter é pelo texto no change do Edit (INICIA COM) begin if sEdtPesquisa.Text <> EmptyStr then begin qQuery.Close; qQuery.SQL.Clear; qQuery.SQL.Add('Select * From crdUf WHERE (crdUf.descricao BETWEEN :BUSCA_INI AND :BUSCA_FIN) '); qQuery.SQL.Add(' AND (crdUf.descricao LIKE :LIMITESPACO) '); qQuery.Parameters.ParamByName('BUSCA_INI').Value := EdtPesquisa.Text; qQuery.Parameters.ParamByName('BUSCA_FIN').Value := EdtPesquisa.Text + 'Z'; // Este Z significa um delimitador de caracteres // para ser contado 1 char a mais depois do STR qQuery.Parameters.ParamByName('LIMITESPACO').Value := str +'%'; qQuery.Open; end else begin qQuery.Close; qQuery.SQL.Clear; qQuery.SQL.Add('Select * From crdUf order by descricao '); qQuery.Open; end; end else if TipoFilter = 1 then // Então o filter é o texto do Edit pelo button (CONTENDO) begin if sEdtPesquisa.Text <> EmptyStr then begin qQuery.Close; qQuery.SQL.Clear; qQuery.SQL.Add('Select * From crdUf WHERE (crdUf.descricao BETWEEN :BUSCA_INI AND :BUSCA_FIN) '); qQuery.SQL.Add(' AND (crdUf.descricao LIKE :LIMITESPACO) '); qQuery.Parameters.ParamByName('BUSCA_INI').Value := EdtPesquisa.Text; qQuery.Parameters.ParamByName('BUSCA_FIN').Value := EdtPesquisa.Text + 'Z'; // Este Z significa um delimitador de caracteres // para ser contado 1 char a mais depois do STR qQuery.Parameters.ParamByName('LIMITESPACO').Value := '%'+ str +'%'; qQuery.Open; end else begin qQuery.Close; qQuery.SQL.Clear; qQuery.SQL.Add('Select * From crdUf order by descricao '); qQuery.Open; end; end; end; procedure TForm1.EdtPesquisaChange(Sender: TObject); begin AccessInsensitive(ADOQuery1,EdtPesquisa,0); end; procedure TForm1.bttFiltrarClick(Sender: TObject); begin Tag := 1; AccessInsensitive(ADOQuery1,EdtPesquisa,Tag); end; end.
Saludos
#19
Posted 07 January 2011 - 02:22 PM
FillList('select * from tabla where ((campo between ''' + Edit1.Text + ''' and ''' + Edit1.Text + 'Z'') and (campo like ''' + str + '%'')) or (campo like ''' + Edit1.Text + '%'')');
#20
Posted 07 January 2011 - 07:40 PM
Se me ocurre;
delphi
FillList('select * from tabla where ((campo between ''' + Edit1.Text + ''' and ''' + Edit1.Text + 'Z'') and (campo like ''' + str + '%'')) or (campo like ''' + Edit1.Text + '%'')');
Perfect cHackAll
Result final
procedure TForm1.AccessInsensitive(qQuery: TADOQuery; sEdtPesquisa: TEdit; TipoFilter: Integer); var i: Integer; str: String; begin str := EmptyStr; for i := 1 to Length(sEdtPesquisa.Text) do str := str + '_'; if TipoFilter = 0 then // Então o filter é pelo texto no change do Edit (INICIA COM) begin if sEdtPesquisa.Text <> EmptyStr then begin qQuery.Close; qQuery.SQL.Clear; qQuery.SQL.Add(' SELECT * from tabla WHERE (campo BETWEEN :BUSCA_INI AND :BUSCA_FIN) '); qQuery.SQL.Add(' AND (campo LIKE :LIMITESPACO) '); qQuery.SQL.Add(' OR (campo like :ESCRITEDIT) '); qQuery.Parameters.ParamByName('BUSCA_INI').Value := EdtPesquisa.Text; qQuery.Parameters.ParamByName('BUSCA_FIN').Value := EdtPesquisa.Text + 'Z'; qQuery.Parameters.ParamByName('LIMITESPACO').Value := str +'%'; qQuery.Parameters.ParamByName('ESCRITEDIT').Value := EdtPesquisa.Text + '%'; qQuery.Open; end else begin qQuery.Close; qQuery.SQL.Clear; qQuery.SQL.Add('Select * From tabla order by campo '); qQuery.Open; end; end else if TipoFilter = 1 then // Então o filter é o texto do Edit pelo button (CONTENDO) begin if sEdtPesquisa.Text <> EmptyStr then begin qQuery.Close; qQuery.SQL.Clear; qQuery.SQL.Add(' SELECT * from tabla WHERE (campo BETWEEN :BUSCA_INI AND :BUSCA_FIN) '); qQuery.SQL.Add(' AND (campo LIKE :LIMITESPACO) '); qQuery.SQL.Add(' OR (campo like :ESCRITEDIT) '); qQuery.Parameters.ParamByName('BUSCA_INI').Value := EdtPesquisa.Text; qQuery.Parameters.ParamByName('BUSCA_FIN').Value := EdtPesquisa.Text + 'Z'; qQuery.Parameters.ParamByName('LIMITESPACO').Value := '%'+ str +'%'; qQuery.Parameters.ParamByName('ESCRITEDIT').Value := '%'+ EdtPesquisa.Text + '%'; qQuery.Open; end else begin qQuery.Close; qQuery.SQL.Clear; qQuery.SQL.Add('select * from tabla order by campo '); qQuery.Open; end; end; end;
Agora sí estas perfect amigo.
Muchas gracias.