[okular] [Bug 468036] Form: NaN in form total (UK IHT 411)

Dave Gilbert bugzilla_noreply at kde.org
Fri Apr 7 12:07:46 BST 2023


https://bugs.kde.org/show_bug.cgi?id=468036

--- Comment #3 from Dave Gilbert <gilbertd+kde at treblig.org> ---
I'm seeing a few scripts that run, the two that produce NaN are:

------------------------------------------------------
//set values in boxes to variable\r\nvar tot =
this.getField(\"Grand_Total_stock_1\");\r\nvar tot1 =
Number(this.getField(\"Total_1\").valueAsString);\r\nvar tot2 =
Number(this.getField(\"Total_2\").valueAsString);\r\nvar tot3 =
Number(this.getField(\"Total_3\").valueAsString);\r\nvar tot4 =
Number(this.getField(\"Total_4\").valueAsString);\r\nvar tot5 =
Number(this.getField(\"Total_5\").valueAsString);\r\nvar tot6 =
Number(this.getField(\"Total_6\").valueAsString);\r\nvar tot7 =
Number(this.getField(\"Total_7\").valueAsString);\r\n\r\n//set an array of
above variables\r\nvar arrTotal =[tot1, tot2, tot3, tot4, tot5, tot6,
tot7];\r\n\r\n//loop through variables to add\r\nvar result = 0;\r\nfor (i=0; i
< arrTotal.length; i++)\r\n    {\r\n        result += arrTotal[i]\r\n   
};\r\n\r\n//place total of array loop in total box\r\ntot.value =
result;\r\n\r\n//if(tot.value == 0){\r\n//tot.value = \"\";\r\n//};\r\n

//set values in boxes to variable
var tot = this.getField(\"Grand_Total_stock_1\");
var tot1 = Number(this.getField(\"Total_1\").valueAsString);
var tot2 = Number(this.getField(\"Total_2\").valueAsString);
var tot3 = Number(this.getField(\"Total_3\").valueAsString);
var tot4 = Number(this.getField(\"Total_4\").valueAsString);
var tot5 = Number(this.getField(\"Total_5\").valueAsString);
var tot6 = Number(this.getField(\"Total_6\").valueAsString);
var tot7 = Number(this.getField(\"Total_7\").valueAsString);

//set an array of above variables
var arrTotal =[tot1, tot2, tot3, tot4, tot5, tot6, tot7];
//loop through variables to add
var result = 0;
for (i=0; i < arrTotal.length; i++)
    {
        result += arrTotal[i]
    };
//place total of array loop in total box
tot.value = result;
//if(tot.value == 0){
//tot.value = \"\";
//};

------------------------------------------------------
//set values in boxes to variable\r\nvar totStk =
this.getField(\"Grand_total_stock_2\");\r\nvar totStk1 =
Number(this.getField(\"Total_stock_1\").valueAsString);\r\nvar totStk2 =
Number(this.getField(\"Total_stock_2\").valueAsString);\r\nvar totStk3 =
Number(this.getField(\"Total_stock_3\").valueAsString);\r\nvar totStk4 =
Number(this.getField(\"Total_stock_4\").valueAsString);\r\nvar totStk5 =
Number(this.getField(\"Total_stock_5\").valueAsString);\r\nvar totStk6 =
Number(this.getField(\"Total_stock_6\").valueAsString);\r\nvar totStk7 =
Number(this.getField(\"Total_stock_7\").valueAsString);\r\nvar totStk8 =
Number(this.getField(\"Total_stock_8\").valueAsString);\r\nvar totStk9 =
Number(this.getField(\"Total_stock_9\").valueAsString);\r\nvar totStk10 =
Number(this.getField(\"Total_stock_10\").valueAsString);\r\nvar totStk11 =
Number(this.getField(\"Total_stock_11\").valueAsString);\r\nvar totStk12 =
Number(this.getField(\"Total_stock_12\").valueAsString);\r\nvar totStk13 =
Number(this.getField(\"Total_stock_13\").valueAsString);\r\nvar totStk14 =
Number(this.getField(\"Total_stock_14\").valueAsString);\r\n\r\n//set an array
of above variables\r\nvar arrTotalStk =[totStk1, totStk2, totStk3, totStk4,
totStk5, totStk6, totStk7, totStk8, totStk9, totStk10, totStk11, totStk12,
totStk13, totStk14];\r\n\r\n//loop through variables to add\r\nvar resultStk =
0;\r\nfor (i=0; i < arrTotalStk.length; i++)\r\n    {\r\n        resultStk +=
arrTotalStk[i]\r\n    }\r\n\r\n//place total of array loop in total
box\r\ntotStk.value = resultStk;\r\n\r\n//if(totStk.value ==
0){\r\n//totStk.value = \"\";\r\n//};

//set values in boxes to variable
var totStk = this.getField(\"Grand_total_stock_2\");
var totStk1 = Number(this.getField(\"Total_stock_1\").valueAsString);
var totStk2 = Number(this.getField(\"Total_stock_2\").valueAsString);
var totStk3 = Number(this.getField(\"Total_stock_3\").valueAsString);
var totStk4 = Number(this.getField(\"Total_stock_4\").valueAsString);
var totStk5 = Number(this.getField(\"Total_stock_5\").valueAsString);
var totStk6 = Number(this.getField(\"Total_stock_6\").valueAsString);
var totStk7 = Number(this.getField(\"Total_stock_7\").valueAsString);
var totStk8 = Number(this.getField(\"Total_stock_8\").valueAsString);
var totStk9 = Number(this.getField(\"Total_stock_9\").valueAsString);
var totStk10 = Number(this.getField(\"Total_stock_10\").valueAsString);
var totStk11 = Number(this.getField(\"Total_stock_11\").valueAsString);
var totStk12 = Number(this.getField(\"Total_stock_12\").valueAsString);
var totStk13 = Number(this.getField(\"Total_stock_13\").valueAsString);
var totStk14 = Number(this.getField(\"Total_stock_14\").valueAsString);

//set an array of above variables
var arrTotalStk =[totStk1, totStk2, totStk3, totStk4, totStk5, totStk6,
totStk7, totStk8, totStk9, totStk10, totStk11, totStk12, totStk13, totStk14];

//loop through variables to add
var resultStk = 0;
for (i=0; i < arrTotalStk.length; i++)
    {
        resultStk += arrTotalStk[i]
    }

//place total of array loop in total box
totStk.value = resultStk;

//if(totStk.value == 0){
//totStk.value = \"\";
//};

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the Okular-devel mailing list