Calculated fields using data in another table

For HanDBase related topics that are not specific to one platform.

Calculated fields using data in another table

Postby mtblair » Tue Aug 09, 2016 6:31 pm

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!
mtblair
 
Posts: 2
Joined: Tue Aug 09, 2016 6:17 pm

Re: Calculated fields using data in another table

Postby mjhanna » Wed Aug 10, 2016 4:29 pm

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.
Michael
(Only a user and not affiliated with DDH Software, but working with computer databases for over fifty years.)
mjhanna
 
Posts: 154
Joined: Tue Oct 15, 2013 10:56 am
Location: New Mexico

Re: Calculated fields using data in another table

Postby mtblair » Wed Aug 10, 2016 5:44 pm

Thanks! That does work. It's probably no more work than trying to get a database field constant to work in the formula.
mtblair
 
Posts: 2
Joined: Tue Aug 09, 2016 6:17 pm


Return to HanDBase General Discussion

Who is online

Users browsing this forum: Bing [Bot] and 1 guest