Page 1 of 1

Trapping exception to dynamically code a work around

Posted: Tue 02 Sep 2014 22:45
by sandy771
I have an application that supports multiple SQLite databases the schema of which is outside of my control.

One of the databases has fields with a definition similar to

create table test (f1 varchar, f2 timestamp)

however that data written to f2 is a float (sqlite allows this) and when I run a simple select query I get an ecception "29222606067.14 julian cannot be represented as a datetime"

How can I trap this situation and deal with it?

Re: Trapping exception to dynamically code a work around

Posted: Wed 03 Sep 2014 09:30
by sandy771
Further to this

I have data typeing mapping to map between a datetime and a float (or vice versa) - but the same error occurs.

I see that something similar has come up before and I notice in the release notes for version 5 it says
Converter from Unix and Julian data formats to ftDateTime is added
If this is fixed, how do I implement it on a field by field basis?

Re: Trapping exception to dynamically code a work around

Posted: Thu 04 Sep 2014 12:32
by AlexP
Hello,

To get such date as Float, you should set the NativeDate option to False and use the AsFloat method for the field. If you want to display such float values in the grid, you can use the onGetText event of this field, retrieve the value using the AsFloat method, map it explicitly to string or to date by modifying it as required.