Date field not working in relationship

Discuss plans for a future version of HanDBase for the Google Android platform

Date field not working in relationship

Postby Gab-Hop » Wed Jun 10, 2015 6:12 am

Hello Dave
I have a parent DB which has an hours value
It is linked to a child db in which i make an (oil change) record
In it i put in the change date, and a calculated field adds the hours value (in days) to the (change date)
This gives me a (due date) for the next oil change
in this example i have set the due date to 12/6/2015

So far all works well, but now i bring the due date back to the parent DB. It shows up correctly but when i try to calculate anything from this relationship field the calculation seems to only calculate from the 1/1/1904

eg: i made a calculated field in the parent DB with the formula of (relationship:due date + 0) this came out as 13/1/1904 instead of 12/6/2015
I think its adding the days of the current month to the default lowest date of 1/1/1904
That is how it gets to 13. Tomorrow the formula will read 14 ect.

Is there another way to transfer the date value back to the parent so that you can calculate from it.?
Thanks Gabriel
Gab-Hop
 
Posts: 45
Joined: Mon Jan 13, 2014 11:34 pm
Location: New Zealand

Re: Date field not working in relationship

Postby aa6vhDave » Wed Jun 10, 2015 10:02 am

There are some things that HanDBase does with date and time fields and calculated fields that can trip you up.

Dates and time are normally stored as an integer value, the number of days since 1/1/1904, or the number of seconds since midnight.

However, computational date fields can have dates stored as the string "6/6/2015", if you specify to display as date, rather than the number of days. So if you do any calculations on that computed date field, you end up just using the first digit (the 6), since HB will truncate a number at the first non numeric character in the string.

The solution that I found is to have all of my computational fields display as integer. I then add a last computational field that displays as a date, with the formula "FinalCalculatedDateField + 0".

This is also true for time fields.

Hope this gives you an idea on where to look.
aa6vhDave
 
Posts: 53
Joined: Mon Aug 19, 2013 1:42 pm

Re: Date field not working in relationship

Postby Gab-Hop » Wed Jun 10, 2015 2:10 pm

Yes thanks
I also discovered that was the case not long after my post
I made all date fields display as integer values through calculational fields and did any computing from these
Thanks
Gab-Hop
 
Posts: 45
Joined: Mon Jan 13, 2014 11:34 pm
Location: New Zealand


Return to HanDBase for Android

Who is online

Users browsing this forum: No registered users and 1 guest

cron