I am building a form that calculates body fat. I have been using formcalc in adobe designer 7.0 to complete the form up to this point. I have completed all components with the exception of the final calculation. The form returns two numbers that must be used to reference an array to get the final body fat calculation.
The fields that the form returns to me are Circumference and HeightT
I need to use these to access and array such as
bodyfat(Circumference,HeightT) and return a value for body fat.
the example I am working on returns circumference as 19.0 and HeightT as 62. This should return a value of 21.
I need to look through and array to find the answer. My array would be the below table. I can't seem to figure out how to create and access this array using formcalc. Thanks for your help.
I would prefer to do this in formcalc if possible, but if I have to use javascript I am willing to learn.
60 60.5 61 61.5 62 62.5 63 63.5
13.5 9 9
14.0 11 11 10 10 10 10 9 9
14.5 12 12 12 11 11 11 11 10
15.0 13 13 13 13 12 12 12 12
15.5 15 14 14 14 14 13 13 13
16.0 16 16 15 15 15 15 14 14
16.5 17 17 16 16 16 16 15 15
17.0 18 18 18 17 17 17 17 16
17.5 19 19 19 18 18 18 18 17
18.0 20 20 20 19 19 19 19 18
18.5 21 21 21 20 20 20 20 19
19.0 22 22 22 21 21 21 21 20
19.5 23 23 23 22 22 22 22 21
20.0 24 24 24 23 23 23 23 22
20.5 25 25 25 24 24 24 24 23
21.0 26 26 25 25 25 25 24 24
I set up the array with the following code
//circumference starts at 13 and increments by .5. to access array cirmuference will be multiplied by 2 and subtract 26
// HeighgtT start at 60 and increments by .5 to access array HeightT will be multiplied by 2 and subtract 120
n = new Array();
n = new Array();
var Circumf = F.P1.Circumference;
var ht = F.P1.HeightT ;
ht.rawValue = ((ht.rawValue) *2) - 120;
Circumf.rawValue = ((Circumf.rawValue) *2) - 26;
n [0] = '9,9,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,'.split(',');
n [1] = '11,11,10,10,10,10,9,9,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,'.split(',');
this.rawValue = (n[(Circumf.rawValue)][(ht.rawValue)]);
I just added all of the lines I needed. Used a formula as seen above to convert my value to the array position and pulled the information. Hope this helps anyone else that is trying to do something like this.