Field order and calculations

Discuss the HanDBase for Windows Desktop program, conduits, and add-ons.

Field order and calculations

Postby idamtnboy » Wed May 21, 2014 11:15 pm

Please clarify exactly what is required as far as field order, as in the field number used, where it is positioned in the view window for the DB, and the effect on calculations. Do you fields just need to be in the order of Field 1, Field 2, etc., and with every field being used for a calculation in a subsequent field being to the left, and does the order in the view matter? I.e., what is the controlling factor, field number or left to right position in the view?

Does field order remain fixed when the DB is copied to the handheld?
idamtnboy
 
Posts: 34
Joined: Sun Sep 23, 2012 9:21 pm

Re: Field order and calculations

Postby Brian_Houghton » Thu May 22, 2014 5:30 am

Hi,

Thanks for posting.

There is no particular requirement for field order in regards to calculations. This is because when you configure the formula for a calculated field, you specify how the fields you are using are used.

For example, you could have a formula of (F2+F18)/F82

Note that in the above example, F# refers to the field number of the field selected using the field selector popup.



Sent from my Nexus 7 using Tapatalk HD
Kind Regards,
Brian Houghton, DDH Software
Brian_Houghton
 
Posts: 2246
Joined: Wed May 20, 2009 8:30 am

Re: Field order and calculations

Postby mjhanna » Thu May 22, 2014 9:13 am

Hmmm... Well Brian is the expert, but in my experience while it does not seem to matter if the fields used in a calculation are static data, it does seem to matter if those fields are themselves calculated fields. The calculations appear to be performed in field number order, e.g. field F4 is calculated before field F8. So if the formula for field F4 includes F8, the value of field F8 will not yet have been calculated. However I have not tested this in a while, so Dave may have enhanced the code in this respect.
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: Field order and calculations

Postby dhaupert » Thu May 22, 2014 9:27 am

Hi,

I think Brian misunderstood the question in this case, as indeed if a field used in a calculation is also a conditional or calculated field the order does matter. We use the field order to loop through and perform the calculations. So if you have a calc that is:

Field 34 = Field 2 + Field 40
If Field 40 is below Field 34 in the order (as it would be by default) it won't have been udpated yet and the Field 34 calculation could wind up with a wrong answer. In this case, setting the field order to put Field 40 before Field 34 would solve the problem.
dhaupert
 
Posts: 4111
Joined: Tue May 26, 2009 11:51 am

Re: Field order and calculations

Postby mjhanna » Thu May 22, 2014 12:34 pm

Ahhh... Thanks for the clarification, Dave. So it is field "order" not field "number" which determines the order of calculation. I probably knew that, but forgot it, since I seldom re-order the fields. Thanks for the reminder and for correcting my post.
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


Return to HanDBase for Windows

Who is online

Users browsing this forum: No registered users and 0 guests