---
title: "Calc filter by date error"
url: "https://openforis.support/questions/1084/calc-filter-by-date-error"
tags: ["calc"]
status: "accepted"
score: 0
answer_count: 6
asked: "2017-02-23T13:14:15"
last_activity: "2017-03-21T16:52:09"
source: "Open Foris Support - Q&A Forum"
license: "Copyright Open Foris, 2026. Some rights reserved under creative commons license."
---

# Calc filter by date error

Asked by dfinzagr on 2017-02-23

Dear OF team,

when i create a dataset in collect and successfuly import it to Calc i get an error if I want to filter tables according to dates. First of all, they are imported as text variables, which means you cannot filter for example years that are newer then 2001 (> 2001) and more importantly i cannot even use "=". For example filter results = 2017.

>     this is the error i get:

    
    org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.springframework.jdbc.BadSqlGrammarException: jOOQ; bad SQL grammar [select count(*) from "probaaaa"."a_gen_view" where "probaaaa"."a_gen_view"."date1_year" between ? and ?]; nested exception is org.postgresql.util.PSQLException: ERROR: operator does not exist: integer >= character varying
      Hint: No operator matches the given name and argument type(s). You might need to add explicit type casts.
      Position: 89


any simple solutions?


## Accepted answer (score 1, by Mino Togna on 2017-03-08)

Link: https://openforis.support/questions/1084/calc-filter-by-date-error/1131

Hi,

I've just released a new version of Calc that handles date variables as well. 

In order to use date variables, make sure you are using Postgres9.4+.

After having installed Calc-2.1-a11 ( [http://www.openforis.org/tools/calc.html][1] ), you need to create a new workspace.

If you have calculations associated with it, just export the previous calc workspace and import it into the new one.

When filtering by dates, make sure you use the format 'yyyy-MM-dd'. 
Here a picture with an example : 
![alt text][2]

Please let me know if you face other issues.

Thank you,

Mino

  [1]: http://www.openforis.org/tools/calc.html
  [2]: http://www.openforis.org/support/upfiles/Screen_Shot_2017-03-08_at_15.20.02_2.png


## Answer (score 1, by dfinzagr on 2017-03-21)

Link: https://openforis.support/questions/1084/calc-filter-by-date-error/1178

Great! After deleting workspace and reimport everything works as it should. Even with SQLite. Thank you!


## Answer (score 0, by Mino Togna on 2017-02-27)

Link: https://openforis.support/questions/1084/calc-filter-by-date-error/1101

Hi,

at the moment we dont import dates as dates into Calc.

We'll discuss this feature to implement and we'll let you know soon.

Thank you,
Mino


## Answer (score 0, by dfinzagr on 2017-03-21)

Link: https://openforis.support/questions/1084/calc-filter-by-date-error/1176

Hmm it doesnt work. Dates arent recognized as dates (so arent found under "D" tab). But I am using Sqlite. Any easy soluitons?


## Answer (score 0, by Mino Togna on 2017-03-21)

Link: https://openforis.support/questions/1084/calc-filter-by-date-error/1177

Have you deleted the old workspace first?

Calc has not been tested with Sqlite. At the moment only Postgres 9.4+ is supported.

For more information about the required software, please visit the installation requirement page : [http://www.openforis.org/tools/calc/tutorials/installation.html][1]

I hope this helps.

Thank you,
Mino

  [1]: http://www.openforis.org/tools/calc/tutorials/installation.html


## Answer (score 0, by Mino Togna on 2017-03-21)

Link: https://openforis.support/questions/1084/calc-filter-by-date-error/1179

Nice to hear that!

I'm glad it's also working with SQLite ! 

Thanks for letting us know!

Mino
