I am restoring the filter for a Kendo Grid in a Controller from a stored filter string. When there is an exponential (e.g. 1e-9) as a value, FilterDescriptoractory.Create() throws an exception "Expected RightParenthesis". Looking at the filter string it seems to have the correct number of parentheses.
On some occasions exponentials work but I can not determine under which. Under which conditions will exponentials work in filters?
var filterString = "ShipName~eq~'ShipName1'~and~(Freight~eq~0~or~Freight~gte~1e-9)~and~ShipCity~gt~0";
var filters = FilterDescriptorFactory.Create(filterString);
Hello Jaroslav,
Thank you for the additional information provided.
As the exponentials were not considered at all in the filter expression implementation, I would consider the discussed case to be a missing functionality in the utility, rather than a bug in its implementation. Therefore, I have changed the type of the current thread to Feature request. Also, just to be clear to other members of the community, I have altered slightly the title of the thread.
Regards,
Veselin Tsvetanov
Progress Telerik
Hi Veselin,
It turns out that exponentials actually don't work, even when no exception is thrown.
The simplest case with
var filterString = "Freight~eq~1e-9";
is parsed without exception, but it turns out that the expression is truncated after the "1", so the filter becomes "Freight~eq~1".
The same if you try with a longer expression without parentheses, like
var filterString = "ShipName~eq~'ShipName1'~and~Freight~eq~1e-9~or~Freight~gte~0~and~ShipCity~gt~0";
which is interpreted as "ShipName~eq~'ShipName1'~and~Freight~eq~1"
Regards,
Jaroslav
Hi Jaroslav,
Thank you for the additional info provided, which helped me replicate the issue in question.
By now the filter descriptor has not been tested with exponential number representation. Having that said, can you share a filter string containing an exponential that would not result in the error in question? That would allow us to analyze the differences in the two cases. So far the case seems a scenario, which has not been considered and covered in the filter implementation.
Regards,
Veselin Tsvetanov
Progress Telerik
Hi,
You can copy the above lines into any controller in a Kendo application. (I used the default Kendo application from the New project template.)
Hi Jaroslav,
Thank you for reporting the issue. To be able to confirm that the reported behavior is a bug or a supported/unsupported functionality we should be able to reproduce the case and investigate it.
Can you provide a runnable example + step-by-step instructions for reproducing the reported behavior?
Looking forward to your reply.
Regards,
Petar
Progress Telerik