Skip to content
This repository has been archived by the owner on Feb 1, 2021. It is now read-only.

Filter by number exception #31

Open
PetrF0X opened this issue Mar 16, 2016 · 2 comments
Open

Filter by number exception #31

PetrF0X opened this issue Mar 16, 2016 · 2 comments

Comments

@PetrF0X
Copy link
Contributor

PetrF0X commented Mar 16, 2016

Hi,

I found it impossible to filter items by number field, when I want to achieve a constraint with no limit (for example all greater than 10). The filter should look like fieldId=10-null. When I change the float to Float in NumberInterval class and pass 10 and null to it, it looks like this. But after that the API says

APIException [status=Bad Request, error=Expected value of form x-y, description=Expected value of form x-y, parameters=null]

So I tried to outwit this error by inserting a reasonably big number, like Integer.MAX_VALUE instead of the null, but it ends up with the same exception. Even if I pass a number like 1000000000, it crashes with the same error.

But the filtering in Podio allows me to do all the stuff above. Am I doing something wrong or is the filtering here not fully implemented?

Btw. I am able to propose a pull request with some changes, but I tried many things with no good result... Can you give me some hints?

Thank you,
Petr

@mhrdev
Copy link
Contributor

mhrdev commented Mar 17, 2016

  1. You should do "fieldId=10-" instead of " "fieldId=10-null"
  2. It looks like the number in the request gets converted to the scientific notation (eg. -2.14748365E9). That causes the error.
  3. BTW: Podio-java client uses an old (unsupported) method get_items. We should move away from it and use filter_items (this pull_request is actually addressing this issue - I have no time currently to look at it)

@PetrF0X
Copy link
Contributor Author

PetrF0X commented Mar 19, 2016

Hi Marek @mhrdev,
thank you for the hints. I have looked at it and found out that the changes in getItems() to use filter_items requires also changes in FilterBy classes, because the API expects objects, not strings... I have a partially working solution, I will maybe provide a full working pull request in the future...

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants