Keep getting SyntaxError: missing ) in parenthetical 46:
i've renamed array , keep getting error. when run script renamed array in console, calculates appropriately. i've tried going through line line , can't seem find error. might need fresh set of eyes catch mistake. per usual, everyones & advice appreciated.
(original script)
var aw = this.getfield("weight").value;
var t = this.getfield("temperature").value;
var b = math.ceil(aw / 1000) * 1000;
var c = math.floor(aw / 1000) * 1000;
var d = 10000;
var e = 18300;
var m = 1;
var upperwt = b;
if (b > e) {
upperwt = e;
}
var lowerwt = c;
if (c < d) {
lowerwt = d;
}
var rngtable = new array();
rngtable[18300] = ["4686","4857","5029","5201","5942","7370"];
rngtable[18000] = ["4530","4695","4860","5025","5732","7088"];
rngtable[17000] = ["4010","4152","4295","4437","5031","6149"];
rngtable[16000] = ["3550","3675","3800","3925","4412","5285"];
rngtable[15000] = ["3127","3229","3330","3431","3857","4663"];
rngtable[14000] = ["2744","2841","2938","3035","3412","4090"];
rngtable[13000] = ["2382","2461","2540","2619","2925","3475"];
rngtable[12000] = ["2242","2314","2385","2456","2727","3203"];
rngtable[11000] = ["2160","2227","2295","2362","2592","2958"];
rngtable[10000] = ["2085","2152","2220","2287","2493","2787"];
var nwt = this.getfield("weight").value;
var ntemp = 5;
var f = math.round(rngtable[upperwt][ntemp]);
var g = math.round(rngtable[lowerwt][ntemp]);
if (t >= (-18) && t < (-7)) {
var f = math.round(((((rngtable[upperwt][ntemp-4]) - (rngtable[upperwt][ntemp-5])) / 11) * (t + 18)) + (1 * rngtable[upperwt][ntemp-5]));
var g = math.round(((((rngtable[lowerwt][ntemp-4]) - (rngtable[lowerwt][ntemp-5])) / 11) * (t + 18)) + (1 * rngtable[lowerwt][ntemp-5]));
} else if (t >= (-7) && t < 0) {
var f = math.round(((((rngtable[upperwt][ntemp-3]) - (rngtable[upperwt][ntemp-4])) / 11) * (t + 7)) + (1 * rngtable[upperwt][ntemp-4]));
var g = math.round(((((rngtable[lowerwt][ntemp-3]) - (rngtable[lowerwt][ntemp-4])) / 11) * (t + 7)) + (1 * rngtable[lowerwt][ntemp-4]));
} else if (t >= 0 && t < 4) {
var f = math.round(((((rngtable[upperwt][ntemp-3]) - (rngtable[upperwt][ntemp-4])) / 11) * (t - 4)) + (1 * rngtable[upperwt][ntemp-3]));
var g = math.round(((((rngtable[lowerwt][ntemp-3]) - (rngtable[lowerwt][ntemp-4])) / 11) * (t - 4)) + (1 * rngtable[lowerwt][ntemp-3]));
} else if (t >= 4 && t < 16) {
var f = math.round(((((rngtable[upperwt][ntemp-2]) - (rngtable[upperwt][ntemp-3])) / 11) * (t - 4)) + (1 * rngtable[upperwt][ntemp-3]));
var g = math.round(((((rngtable[lowerwt][ntemp-2]) - (rngtable[lowerwt][ntemp-3])) / 11) * (t - 4)) + (1 * rngtable[lowerwt][ntemp-3]));
} else if (t >= 16 && t < 27) {
var f = math.round(((((rngtable[upperwt][ntemp-1]) - (rngtable[upperwt][ntemp-1])) / 11) * (t - 16)) + (1 * rngtable[upperwt][ntemp-2]));
var g = math.round(((((rngtable[lowerwt][ntemp-1]) - (rngtable[lowerwt][ntemp-1])) / 11) * (t - 16)) + (1 * rngtable[lowerwt][ntemp-2]));
} else if (t >= 27 && t < 38) {
var f = math.round(((((rngtable[upperwt][ntemp]) - (rngtable[upperwt][ntemp-1])) / 11) * (t - 27)) + (1 * rngtable[upperwt][ntemp-1]));
var g = math.round(((((rngtable[lowerwt][ntemp]) - (rngtable[lowerwt][ntemp-1])) / 11) * (t - 27)) + (1 * rngtable[lowerwt][ntemp-1]));
}
var h = (upperwt-lowerwt);
if (h == 0) {
h = m;
}
if (aw >= lowerwt && aw <= upperwt) {
this.getfield("cwt_dist").value = ((((f - g) / (h)) * (aw - lowerwt)) + (g));
}
if aw = 17500 & t = 16, calculates correctly 4731
(script renamed array)
var aw = this.getfield("weight").value;
var t = this.getfield("temperature").value;
var b = math.ceil(aw / 1000) * 1000;
var c = math.floor(aw / 1000) * 1000;
var d = 10000;
var e = 18300;
var m = 1;
var upperwt = b;
if (b > e) {
upperwt = e;
}
var lowerwt = c;
if (c < d) {
lowerwt = d;
}
var disttable = new array();
disttable[18300] = ["4686","4857","5029","5201","5942","7370"];
disttable[18000] = ["4530","4695","4860","5025","5732","7088"];
disttable[17000] = ["4010","4152","4295","4437","5031","6149"];
disttable[16000] = ["3550","3675","3800","3925","4412","5285"];
disttable[15000] = ["3127","3229","3330","3431","3857","4663"];
disttable[14000] = ["2744","2841","2938","3035","3412","4090"];
disttable[13000] = ["2382","2461","2540","2619","2925","3475"];
disttable[12000] = ["2242","2314","2385","2456","2727","3203"];
disttable[11000] = ["2160","2227","2295","2362","2592","2958"];
disttable[10000] = ["2085","2152","2220","2287","2493","2787"];
var nwt = this.getfield("weight").value;
var ntemp = 5;
var f = math.round(disttable[upperwt][ntemp]);
var g = math.round(disttable[lowerwt][ntemp]);
if (t >= (-18) && t < (-7)) {
var f = math.round(((((disttable[upperwt][ntemp-4]) - (disttable[upperwt][ntemp-5])) / 11) * (t + 18)) + (1 * disttable[upperwt][ntemp-5]));
var g = math.round(((((disttable[lowerwt][ntemp-4]) - (disttable[lowerwt][ntemp-5])) / 11) * (t + 18)) + (1 * disttable[lowerwt][ntemp-5]));
} else if (t >= (-7) && t < 0) {
var f = math.round(((((disttable[upperwt][ntemp-3]) - (disttable[upperwt][ntemp-4])) / 11) * (t + 7)) + (1 * disttable[upperwt][ntemp-4]));
var g = math.round(((((disttable[lowerwt][ntemp-3]) - (disttable[lowerwt][ntemp-4])) / 11) * (t + 7)) + (1 * disttable[lowerwt][ntemp-4]));
} else if (t >= 0 && t < 4) {
var f = math.round(((((disttable[upperwt][ntemp-3]) - (disttable[upperwt][ntemp-4])) / 11) * (t - 4)) + (1 * disttable[upperwt][ntemp-3]));
var g = math.round(((((disttable[lowerwt][ntemp-3]) - (disttable[lowerwt][ntemp-4])) / 11) * (t - 4)) + (1 * disttable[lowerwt][ntemp-3]));
} else if (t >= 4 && t < 16) {
var f = math.round(((((disttable[upperwt][ntemp-2]) - (disttable[upperwt][ntemp-3])) / 11) * (t - 4)) + (1 * disttable[upperwt][ntemp-3]));
var g = math.round(((((disttable[lowerwt][ntemp-2]) - (disttable[lowerwt][ntemp-3])) / 11) * (t - 4)) + (1 * disttable[lowerwt][ntemp-3]));
} else if (t >= 16 && t < 27) {
var f = math.round(((((disttable[upperwt][ntemp-1]) - (disttable[upperwt][ntemp-1])) / 11) * (t - 16)) + (1 * disttable[upperwt][ntemp-2]));
var g = math.round(((((disttable[lowerwt][ntemp-1]) - (disttable[lowerwt][ntemp-1])) / 11) * (t - 16)) + (1 * disttable[lowerwt][ntemp-2]));
} else if (t >= 27 && t < 38) {
var f = math.round(((((disttable[upperwt][ntemp]) - (disttable[upperwt][ntemp-1])) / 11) * (t - 27)) + (1 * disttable[upperwt][ntemp-1]));
var g = math.round(((((disttable[lowerwt][ntemp]) - (disttable[lowerwt][ntemp-1])) / 11) * (t - 27)) + (1 * disttable[lowerwt][ntemp-1]));
}
var h = (upperwt-lowerwt);
if (h == 0) {
h = m;
}
if (aw >= lowerwt && aw <= upperwt) {
this.getfield("cwt_dist").value = ((((f - g) / (h)) * (aw - lowerwt)) + (g));
}
syntaxerror: missing ) in parenthetical
46: @ line 47
i'm not getting syntax errors either code. sure that's exact code you're using?
by way, there's no need put parentheses around numbers, in statement:
t >= (-18)
it be:
t >= -18
More discussions in JavaScript
adobe
Comments
Post a Comment