Expand my Community achievements bar.

Scripting (Sums of two fields to equal a rounded value and to "if" to another value)

Avatar

Level 1

If
Hello everyone, I am making a document that needs some formulating/scripting done in it and out of all the forums, I cant find anything to work.

This is what I have.

Field 1 (Value) Field 2 (Value) Field 3 (result); The result field will also round to the nearist thousands (Round((horsepower / weight)/.01)*.01; now after that I need another field to use the "if" statement to put a value in another field if the result matches the result field. I know I am making this complicated but let me show you what I have.

Untitled.png

The first field is a numeric field that the user will input their horsepower.

The second field is a numeric field that the user will input their weight.

The third field is a numeric field that will auto sum the first to fields and round to the nearist thousands

      (Round((horsepower / weight)/.01)*.01

All the steps above are working awesomely. The part I cant get to work is the "if" statement in the fourth Field.

I tried useing this code to make it work but i keep getting an error about the "ratio" field


  If (data0 eq "0") then


      


     qqq0 = "1"


   


elseif (data0 eq "0.1") then


    


     qqq0= "1"


    


elseif (data0 eq "0.10") then



     qqq0= "1"



endif


I used this script with Formcalc and it works on everything else. I think the "round" formula is causing the problem. Also the elseif i used up to 0.35, so 35 lines of code.

Untitled2.png

Any help would be greatly appreciated. Thanks.

0 Replies