Re: Filtering with float fields

[email protected]
Newsgroups gmane.comp.cms.jahia.template
Message-ID <OFE3EA15B8.4D8A6A6A-ONC125715B.00422A65-C125715B.00439162@commaro.com>
Hi Alejandro,

I am working with the latter version of Jahia (4.1 branch) and the 
ContainerFilterBean already has a constructor that explicitly accepts 
number format as a parameter.
I have just taken a look at the source code of the Jahia 4.0.5. It seems, 
that the number filtering only works for long values and not for float or 
double.
If you have Jahia's source code, you could check the compare(...) method 
in the FilterClause class. The values 'valueFrom' and 'valueTo', which you 
specify by calling addRangeClause(...) method, 
are converted there using Long.parseLong(), which is valid only for values 
of type long.

Kind regards.
Sergiy.




Alejandro Fernández <[email protected]> 
24.04.2006 18:27
Please respond to
<[email protected]>


To
<[email protected]>
cc

Subject
Filtering with float fields






Hi,
 
I am trying to apply a filter to a container in a field defined as Float. 
I have only found how to add a RangeClause to a ContainerFilterBean in the 
case of string and date, but not Float.
 
I am working with Jahia 4.0.5. and this is the source code for the 
filtering:
 
    myContainerFilter = new ContainerFilterBean("aFloatField", true, 
jParams.getEntryLoadRequest()); // with the field name
    // Adding equality comparison with selected values
    myContainerFilter.addRangeClause(">","<",valueFrom,valueTo);
 
This filtering always returns 0 element found, because only String values 
are allowed for the fields valueFrom and valueTo.
 
Thank you for your helping.
 
Cheers.
 
Alex.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.