Newbies garrysy Posted August 22, 2019 Newbies Posted August 22, 2019 Can anyone assist me to convert below script to Filemaker function? Thanks. function calcVi(Q1,Q2) { var Q3,Q4,Q5,Q6,Q7; if ( Q2 >= 2 && Q2 < 4){ Q3 = 0.827 * Math.pow(Q2,2) + 1.632 * Q2 - 0.181; Q4 = 0.3094 * Math.pow(Q2,2) + 0.182 * Q2; Q6 = (Q3 + Q4 - Q1) / Q4 * 100; } if ( Q2 >= 4 && Q2 < 6.1){ Q3 = -2.6758 * Math.pow(Q2,2) + 96.671 * Q2 - 269.664 * Math.sqrt(Q2) + 215.025; Q4 = -7.1955 * Math.pow(Q2,2) + 241.992 * Q2 - 725.478 * Math.sqrt(Q2) + 603.88; Q6 = (Q3 + Q4 - Q1) / Q4 * 100; } if ( Q2 >= 6.1 && Q2 < 7.2){ Q3 = 2.32 * Math.pow(Q2,1.5626); Q4 = 2.838 * Math.pow(Q2,2) - 27.35 * Q2 + 81.83; Q6 = (Q3 + Q4 - Q1) / Q4 * 100; } if ( Q2 >= 7.2 && Q2 < 12.4){ Q3 = 0.1922 * Math.pow(Q2,2) + 8.25 * Q2 - 18.728; Q4 = 0.5463 * Math.pow(Q2,2) + 2.442 * Q2 - 14.16; Q6 = (Q3 + Q4 - Q1) / Q4 * 100; } if ( Q2 >= 12.4 && Q2 <= 70){ Q3 = 1795.2 * Math.pow(Q2,(-2)) + 0.1818 * Math.pow(Q2,2) + 10.357 * Q2 - 54.547; Q4 = 0.6995 * Math.pow(Q2,2) - 1.19 * Q2 + 7.6; Q6 = (Q3 + Q4 - Q1) / Q4 * 100; } if ( Q2 > 70){ Q3 = 0.1684 * Math.pow(Q2,2) + 11.85 * Q2 -97; Q5 = 0.8353 * Math.pow(Q2,2) + 14.67 * Q2 -216; Q4 = 0.6669 * Math.pow(Q2,2) + 2.82 * Q2 -119; Q6 =(Q5 - Q1) / Q4 * 100; } if (Q6 >= 100) { Q7 = ((Math.log(Q3) / Math.log(10)) - (Math.log(Q1) / Math.log (10))) / ( Math.log(Q2)/ Math.log(10)); Q6 = (( Math.pow(10,Q7)-1) / 0.00715 ) + 100; } Q6 = parseInt(Q6 + 0.5); return Q6; }
Fitch Posted August 25, 2019 Posted August 25, 2019 https://fmhelp.filemaker.com/help/18/fmp/en/#page/FMP_Help%2Fmathematical-operators.html%23ww1029353 https://fmhelp.filemaker.com/help/18/fmp/en/#page/FMP_Help%2Flogical-operators.html https://fmhelp.filemaker.com/help/18/fmp/en/#page/FMP_Help%2Fsqrt.html%23 https://fmhelp.filemaker.com/help/18/fmp/en/#page/FMP_Help%2Flet.html%23
Fitch Posted September 2, 2019 Posted September 2, 2019 I see this was cross-posted here: https://community.filemaker.com/en/s/question/0D50H000075EFdbSAG/can-the-script-below-be-converted-to-filemaker-function Please be respectful of people's time and let us know in future if you're doing that.
Recommended Posts
This topic is 1907 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now