A lookup table is essentially a table which you access by "house numbers". Transposed to (Acrobat) JavaScript, it is a multi-dimensional array. In your case, it would be 2-dimensional.
The easiest to implement would be if the second condition would also be a dropdown. In this case, you could set up both dropdowns with the face value (that's what you see in the dropdown) and the return value corresponding to the row or column number where you would find the resulting value. These two numbers would correspond to the indices in the two-dimensional array.
A very simplistic example:
Your first dropdown consists of the following pairs (combo box named dd1):
"my first", 0
"my second", 1
"my third", 2
Your second dropdown had the following pairs (combo box dd2):
"red", 0
"green", 1
"blue", 2
Your lookup table could then look like this (you will need some imagination to turn that into a table; this braindead forum software does not let me enter simple tables):
source red green blue
my first 12 34 187
my second 74 99 1
my third 122 9 231
Converting this to Acrobat JavaScript would give you the following (in a real form, that would be defined in a document-level script):
var myLUTarr = new Array() ;
myLUTarr[0] = [12,34,187] ;
myLUTarr[1] = [74,99,1] ;
myLUTarr[2] = [122,9,231] ;
The result would then be calculated (very roughly; you may have to add conditions for valid selections, such as adding a "select me", -1 selection to the dropdowns, making that entry the default)
if (this.getField("dd1").value >= 0 && this.getField("dd2").value >= 0) {
event.value = myLUTarr[this.getField("dd1"].value*1][this.getField("dd2").value*1] ;
}
And that should do it. Now, you can expand the whole thing. This can get pretty big, but arrays are handled quite well in Acrobat JavaScript; some time ago, we did a demo for a lookup table containing the distances between some 2500 points… which turned out into a file size of 6MB, but it loaded within a few seconds, and lookups were instanteanously.
hope this can help.
Max Wyss.