Page 1 of 1

Calculated fields using data in another table

PostPosted: Tue Aug 09, 2016 6:31 pm
by mtblair
I want to have a field be calculated using a constant from another table.

The scenario:

I have a field where a person enters an inter value representing knots (speed).
I want the field next to it to show the conversion of that to miles per hour.
The conversion factor is knots times 1.15077945 to get miles per hour (MPH).
The calculation form won't let me enter a constant larger than 1.150.
I created a field in the database record called kts_to_mph, set it to TEXT and the default value of 1.15077945.
Then I can do the calculation knots times kts_to_mph to get my MPH calculated field.
While this works, it's not ideal because I have to store the constant value in each record.
The ideal scenario would be for the constant to reside in another table and get referred to in the calculation.

I spent some time on the forum and knowledge base and couldn't find what I wanted.

The system is:

Windows 10
HanDBase 4 for Android

Any help is appreciated!

Re: Calculated fields using data in another table

PostPosted: Wed Aug 10, 2016 4:29 pm
by mjhanna
I think your problem in the calculation field is the number of values after the decimal point. The HanDBase user manual states that it can support Float fields which have at most 4 places after the decimal point. So I would create a calculated field where the form multiplied MPH by the constant 11507.7945 and then divided by the constant 10000. Note that the result can still only be expressed to a maximum of 4 decimal places. Haven't tried this myself, but I think this should work.

Re: Calculated fields using data in another table

PostPosted: Wed Aug 10, 2016 5:44 pm
by mtblair
Thanks! That does work. It's probably no more work than trying to get a database field constant to work in the formula.