Skip to main content
Participating Frequently
Sep 19, 2016 6:58 PM UTC
Answered

Help trying to calculate and/or interpret value from table data

Trying to create a form field that would calculate / interpret a value to use for Rng based on given WT and Temp values.

Ex.  At 20 degrees, and a WT of 20, my Rng will be 600.  At a WT of 15, my Rng will be 537.

How can I use an array to help me calculate what my Rng value would be if my WT value falls anywhere in-between two of the listed WT values?

Thanks in advance for any and all help.

This topic is closed to new replies. Start a new post to keep the conversation going.
gkaiserilCorrect answer
Inspiring
Sep 19, 2016 7:07 PM UTC

Yes if you use a multi-dimensional array.

3 replies

gkaiserilCorrect answer
Inspiring
Sep 19, 2016 7:07 PM UTC

Yes if you use a multi-dimensional array.

Translate
Participating Frequently
Sep 19, 2016 7:13 PM UTC

Ok great.  Can you point me in the right direction for writing a multi-dimensional array ...?

I'm trying to look through the forum for some examples to better understand and build upon, but got stumped.

Translate
Inspiring
Sep 19, 2016 8:27 PM UTC

The Array object from MDN JavaScript Reference.

You first need to create the array, Then assign an array to a value in the first dimension to get the second dimension.

A sample script including loading the table and extracting from the table:

var RngTable = new Array();
RngTable[20] = [null,null,null,null,null,null,null,null,null,null,null,
null,null,null,null,null,null,null,null,null,"600",
null,null,null,null,null,null,null,null,null,"632"];
RngTable[15] = [null,null,null,null,null,null,null,null,null,null,null,
null,null,null,null,null,null,null,null,null,"537",
null,null,null,null,null,null,null,null,null,"600"];
RngTable[10] = [null,null,null,null,null,null,null,null,null,null,null,
null,null,null,null,null,null,null,null,null,"472",
null,null,null,null,null,null,null,null,null,"545"];

var nWT = 10, nTEMP = 30; 
console.println("WT: " + nWT + " and TEMP: " + nTEMP + " is " + RngTable[nWT][nTEMP]);

Translate