Calc filter by date error

  • Asked
  • Active
  • Viewed 7832 times
0

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?

1

Accepted answer

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 ), 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

Please let me know if you face other issues.

Thank you,

Mino

1

Accepted answer

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

0

Accepted answer

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

0

Accepted answer

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

0

Accepted answer

Nice to hear that!

I'm glad it's also working with SQLite !

Thanks for letting us know!

Mino

Your answer

Markdown text. Shortcuts: Ctrl+B bold, Ctrl+I italic, Ctrl+K link, Ctrl+E code, Ctrl+Shift+V paste as plain text. Tab indents list items and code; press Escape, then Tab, to leave the text box.

Insert an image

Say what the image shows, for people who can't see it.

Keyboard shortcuts

Anywhere

?
Show this list
/
Search
g h
Go to the home page
g q
Go to the questions
g t
Go to the tags
g u
Go to the users
a
Ask a question

Lists of questions

j k
Next or previous question
Enter
Open the question

Question pages

j k
Next or previous post

Shortcuts never apply while you type in a text field. Members can turn them off in their preferences.