I have a table with two value, ex.

A B

10 1,5

12 2,3

14 4,5

18 6,7

.....

....

and inside a form I have a calculation number and I would like to retrieve the B number relative, but the calculated number is not equal at A number...so first I have to find the closest number and then get B number or one interpolation of this.

ex.

the result of calculation is 13 and I would like to have:

12:2,3=13:x

x= (13*2,3)/12

How can do this?

Let ( [

closestA = ExecuteSQL ( "SELECT MAX(A) FROM \"table\" WHERE A<=?" ; "" ; "" ; aCalculatedNumber ) ;

relativeB = ExecuteSQL ( "SELECT B FROM \"table\" WHERE A=?" ; "" ; "" ; closestA )

] ;

relativeB * aCalculatedNumber / closestA

)