Foros Club Delphi

Foros Club Delphi (https://www.clubdelphi.com/foros/index.php)
-   Providers (https://www.clubdelphi.com/foros/forumdisplay.php?f=10)
-   -   TClientDataset1.Filter Error locale (https://www.clubdelphi.com/foros/showthread.php?t=84406)

dison 15-10-2013 15:10:01

TClientDataset1.Filter Error locale
 
Tengo una App Datasnap y estoy teniendo problema con un filtro si la PC tiene el idioma Italy, si el idioma es US todo funciona bien.

If the language of the PC is Italy this filter return 0
var
pricefrom,priceto :Double;
begin
Tclientdataset1.filter := format( ' (pricefrom >= %f and priceto <= %f) ',[1,7000000]);
Tclientdataset1.Filtered:= True;
end;
If the language of the PC is US this filter work fine
var
pricefrom,priceto :Double;
begin
Tclientdataset1.filter := format( ' (pricefrom >= %f and priceto <= %f) ',[1,7000000]);
Tclientdataset1.Filtered:= True;
end;

I'm getting crazy with this, i had tried everything, some help is appreciated

ecfisa 16-10-2013 06:55:49

Hola dison.

Por favor, recuerda usar los TAG's :



Con respecto a tu consulta, me quedan estas dudas:
  • pricefrom y priceto, ¿ Son nombres de variables locales, de campos de una tabla o variables y campos son homónimas ?
  • ¿ Tenes configurada la coma como separador de decimales o de miles ? (DecimalSeparator, ThousandSeparator)

Por si te sirviera de ayuda, un ejemplo de como filtrar por el campo XXX aquellos valores comprendidos entre 101.25 y 1029.33:
Código Delphi [-]
...
var
  pricefrom, priceto: Double;
begin
  pricefrom := 101.25;
  priceto   := 1029.33;
  with ClientDataSet1 do
  begin
    Filter   := Format('(XXX >= %f) AND (XXX <= %f) ', [pricefrom, priceto]);
    Filtered := True;
  end;
...


Saludos :)

dison 31-10-2013 14:21:52

The problem is about the Locale setting of the PC and the decimal separator.

I resolved this with Trunc function to extract the integer part.

Thanks.

ecfisa 31-10-2013 15:25:39

Cita:

Empezado por dison (Mensaje 469138)
The problem is about the Locale setting of the PC and the decimal separator.

I resolved this with Trunc function to extract the integer part.

Thanks.

Cita:

El problema está relacionado con la configuración local del PC y el separador decimal
Resolví esto extrayendo la parte entera con la función Trunc.

Gracias
Gracias por publicarnos la solución que encontraste ^\||/. Pero este es un foro hispano, escribinos en español dominicano que con seguridad te entenderemos mejor que en inglés.

Y si... es claro que tomando sólo la parte entera el problema desaparece (al igual que el separador decimal), la dificultad se presenta cuando precisas el valor como número decimal.


Saludos :)


La franja horaria es GMT +2. Ahora son las 11:05:55.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi