ProcessMaker code contributions

Moderator: amosbatto

Good Day,

Hope Someone can Help me with a Dilemma of Time Calculations Total Hours and minutes and Place result into a Text Box outside of the Grid,
I have attached my Process to make it easy to have a look, my Java code is in the process.

Thank you kindly for that advice and Help

Kind Regards,
Select Overtime to get the grid
(105.38 KiB) Downloaded 97 times
Hi guys, if you need to get the sum or average of a grid column, you can use Aggregate functions, to get more information about them click on the following link: ... _functions

You can also use javascript to loop through the rows in the grid and get the value of the field you want to work with.

A quick sample
Code: Select all
function sumGridColumn(gridName, fieldName) {
    /* Get the number of rows in the grid */
    var rowCount = Number_Rows_Grid(gridName, fieldName);
    var total = 0;
    for (var i = 1;i <= rowCount;i++) {
        /* Get the row's field value */
        total += parseFloat(getGridField(gridName, i, fieldName).value);
    return total;

/* Set the value of the field that'll hold the sum */
getField('targetTotalField').value = sumGridColumn('yourGridName', 'fieldToSum');
I chose to use a function in my javascript code because I might need to calculate other columns on demand, this is just a basic example, you can modify the code to do any necessary validation.

Your case is a bit different since you want to sum hours, I've checked the function you're using and found that some variables don't match, even after fixing that issue you won't get the results you want because of time calculation, I would recommend you to work with minutes, so you'd need to create two functions, one to convert your hh:mm formatted time to minutes, and one to convert minutes to hh:mm formatted time, once you have these functions, you can loop through the grid rows, convert each field value to minutes, sum the total of minutes and at the end convert them to hh:mm formatted time to use that value in the Total Hours field.

Good Day,

Pardon me for only coming back now, have a lot on my plate.

Not sure what you mean with "Can you Tell me how you populate the System variable in the form"
I use triggers a lot which I create, to populate fields, Please let me know what exactly you would need or like to understand and I will help with that gladly.

Thank you kindly for your Example code. Starting to get my head around javascript, was hoping that the time calculation will be bit easy, My fault in thinking that.
I do understand what you mean with the conversion of time to minutes and back again, Think i will do this with a hidden fields. before posting the result back to user.

Thank you kindly for the reply and assistance.
Once I have this working I will post back the PM process.

Kind Regards,
Send for clarification

Cost: Will you be using PM entrerprise or open sou[…]

SMS Gateway

Hello natesh, I have a Get ready to use integrate[…]

delete information after CSV export

thanks for your attention, i have some change on y[…]

Thanx again amosbatto... I'll re-check file permis[…]