Connecting two codes to work together

Avatar

Avatar

NY2CA

Avatar

NY2CA

NY2CA

05-11-2012

I am trying to connect the following codes to work together. The way it's constructed one code will work but not the other, this is also true when the code is reversed. The 1st part of the code represents a change in the percentage and the 2nd part of the code calculates the actual percentage.

The percentage is formatted as "00.00% When it exceeds 80.00%, I need it to change color and the same for over 90.00%

if (LTV1st > 80)then

LTV1st.fillColor = "239,122,242"

elseif ($ > 90) then

LTV1st.fillColor = "110,0,0"

else LTV1st.fillColor = "208,208,208"

endif

If(FirstLien>0 and SalesPrice>0) then LTV1st = FirstLien / SalesPrice;

endif

Both are under the formcalc, calculate event.

Thanks.

View Entire Topic

Avatar

Avatar

NY2CA

Avatar

NY2CA

NY2CA

06-11-2012

I am thankful for your help insolving the color problem. By inserting the code, Look at the yellow highlight (100).

if (FirstLien gt 0 and SalesPrice gt 0) then

           var LVT = (100 / SalesPrice) * FirstLien

           if (LVT gt 80 and LVT lt 90) then

                     $.ui.numericEdit.border.fill.color.value = "239,122,242"

                     ;$.fillColor = "239,122,242"

           elseif (LVT gt 90) then

                     $.ui.numericEdit.border.fill.color.value = "180,0,0"

                     ;$.fillColor = "180,0,0"

           else

                     $.ui.numericEdit.border.fill.color.value = "210,210,210"

                     ;$.fillColor = "210,210,210"

           endif

           $ = LVT   

endif

This caused several other fields not to function correctly. I tried to add * 100 and / 100 to these fields but it does not work.

The only field that was affected was the blendrate field which relies on the calculation of the Firstlien, secondlien and salesprice for weighting. Here is the affected code:

if (rate1>0 and FirstLien>0 and rate2>=0 and Second>=0 and SalesPrice>0 and LTV1st>=0 and LTV2nd>=0)

then Blendrate = (rate1 * FirstLien + rate2 * Second) / SalesPrice / (LTV1st + LTV2nd) ;

endif

Thanks.