Page **1** of **1**

### Field order and calculations

Posted:

**Wed May 21, 2014 11:15 pm**
by **idamtnboy**

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?

### Re: Field order and calculations

Posted:

**Thu May 22, 2014 5:30 am**
by **Brian_Houghton**

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

### Re: Field order and calculations

Posted:

**Thu May 22, 2014 9:13 am**
by **mjhanna**

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.

### Re: Field order and calculations

Posted:

**Thu May 22, 2014 9:27 am**
by **dhaupert**

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.

### Re: Field order and calculations

Posted:

**Thu May 22, 2014 12:34 pm**
by **mjhanna**

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.