Share ideas, ask questions, and get feedback about developing for ProcessMaker

Moderator: ArturoRobles

Forum rules: Please post new questions under "Developing processes & programming" for ProcessMaker 2 or 3.
By dpajak
I am having an issue with grid dynaform. I want to add the total of other text field with the sum value. For some reason the Total value column rounds up or down depending on the total of the number. For example if the total should be 5.5 it rounds to 6. If the total is 5.4 it rounds down to 5. I want the total value to portray the exact amount. Here is my xml code. Thanks in advance for the Help.
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<dynaForm type="grid" name="4915570164f4e65f78a14b7055041934/2332666934f4e660fe10d39049219994" width="500" enabletemplate="0" mode="edit">
  <ActivityCode type="dropdown" required="0" readonly="0" mode="edit" options="Array" btn_cancel="Cancel" dependentfields="" defaultvalue="Null" hint="" sqlconnection="" savelabel="0">
    <en>Activity Code  <option name="0">Null</option><option name="1">Administration/Supervision</option><option name="2">Equipment</option><option name="3">Shop Maintenance</option><option name="4">Training Hours</option><option name="5">Locates</option><option name="6">Customer Service</option><option name="7">Punch Lists</option><option name="8">Telemetry Monitor</option><option name="9">Assisting Contractor</option><option name="10">Civic Events</option><option name="11">Monthly Events</option><option name="12">Well/Pump Station Rounds</option><option name="13">Well/Pump Station Bldg Repairs</option><option name="14">Well/Pump Equipment Repair</option><option name="15">Well/Pump Station PM</option><option name="16">Grounds Maintenance</option><option name="17">Samples</option><option name="18">GIS Mapping</option><option name="19">Water Quality Complaints</option><option name="20">Storage Tank Equip Maintenance</option><option name="21">Water Main Repair</option><option name="22">Hydrant Repair/Replacement</option><option name="23">Valve Repair/Replacement</option><option name="24">Hydrant Painting</option><option name="25">Hydrant Inspection/Flushing</option><option name="26">Valve Exercising/Inspection</option><option name="27">Restoration</option><option name="28">B-Box Repairs</option><option name="29">B-Box Inspections</option><option name="30">Water Taps</option><option name="31">Material Pickup</option><option name="41">Final Reading</option><option name="42">Service Line Repairs</option><option name="43">Service Turn On/Off</option><option name="44">Meter Inspections</option><option name="45">Meter Readings/2nd Reading</option><option name="46">Meter Installations</option><option name="47">Meter Repairs</option><option name="48">Meter Replacements</option><option name="49">R.O.M. Installations</option><option name="50">Shut Off Postings</option><option name="51">Crossover Work</option></en>
<Test1 type="text" maxlength="5" validate="Real" required="0" readonly="0" size="5" mode="edit" function="sum" btn_cancel="Cancel">  
<Test2 type="text" maxlength="5" validate="Real" required="0" readonly="0" size="5" mode="edit" function="sum" btn_cancel="Cancel">  
<Amount type="text" maxlength="5" validate="Real" required="0" readonly="1" defaultvalue="0" size="5" mode="edit" formula="Test1+Test2" function="sum" btn_cancel="Cancel" mask="" strto="" dependentfields="" hint="" sqlconnection="" savelabel="0">  
User avatar
By amosbatto
You need to create a field named "Total" in the master form to hold the total from the grid If you grid is named "MyGrid" then you can use code like the following:
Code: Select all
function sumGrid() {
   var noRows = Number_Rows_Grid("MyGrid", "amount");
   total = 0;
   for (var i = 1; i <= noRows; i++) {
       total += parseFloat(getGridField("MyGrid", i, "amount").value);
   getField("Total").value = total;
//When form loads, loop through all existing rows, setting the event handler for "approved":
var totRows = Number_Rows_Grid("MyGrid", "amount");
for (var iRow = 1; iRow <= totRows; iRow++) {
    getGridField("MyGrid", iRow, "amount").onchange = sumGrid;
//set the event handler when the user adds a row:
grid_MyGrid.onaddrow = function(iRow) {
   getGridField("MyGrid", iRow, "amount").onchange = sumGrid;

Sometimes the data comes from a user, like when a […]

Found the solution here:[…]

Learn what's new in ProcessMaker 3.6! We are proud[…]

Hello, I have a case that appears both as comple[…]