Questions and discussion about using ProcessMaker: user interface, running cases & functionality
By evgenyn
#816147
Hello guys,

I have only recently started using PM and loving it. Great tool

I have encountered following issue:

Please see attached screenshot to get a better idea on what im trying to do.
Screenshot_1.png
Screenshot_1.png (39.57 KiB) Viewed 3312 times
- Crane Arrival Time and Off Site Time are outside of the grid
- Start Lift Time and Finish Lift Time are within the grid

i need a few validations to work

1. Finish Lift Time should always be after Start Lift Time
2. Start Lift Time should always be after Crane Arrival Time
3. Finish Lift time should always be before Crane Off Site Time

I have managed to do my own validation outside of the grid but cant make it work within the grid.

Any help will be appreciated!
Format used in all date fields is: YYY-MM-DD, HH:MM:SS
By evgenyn
#816158
Thank you @amosbatto, it worked very well. I more question i have is what code should i use to put validation within the grid to check if Finish Lift Time is not before Start Lift Time?
User avatar
By amosbatto
#816217
You should be able to figure out how to do that from the code example I gave you.

You can do it this way:
Code: Select all
  for (var i = 1; i <= nRows; i++) {
    var startTime  = oGrid.getValue(i, startTimeCol);
    var finishTime = oGrid.getValue(i, finishTimeCol);

    if (moment(finishTime).isBefore(startTime)) {
      msg += "The Finish Lift Time in row "+i+" must be after the Start Lift Time.\n";
      $("#form\\["+gridId+"\\]\\["+i+"\\]\\["+startTimeId+"_label\\]").css("border-color", "red");
    }
    else {
      //set back to default border color:
      $("#form\\["+gridId+"\\]\\["+i+"\\]\\["+startTimeId+"_label\\]").css("border-color", "");
    }

    if (arrivalTime.isAfter(startTime)) {
      msg += "The Start Crane Time in row "+i+" must be after the Crane Arrival Time.\n";
      $("#form\\["+gridId+"\\]\\["+i+"\\]\\["+startTimeId+"_label\\]").css("border-color", "red");
    }
    else {
      //set back to default border color:
      $("#form\\["+gridId+"\\]\\["+i+"\\]\\["+startTimeId+"_label\\]").css("border-color", "");
    }
  
    if (offSiteTime.isBefore(finishTime)) {
      msg += "The Finish Crane Time in row "+i+" must be before the Crane Off Site Time.\n";
      $("#form\\["+gridId+"\\]\\["+i+"\\]\\["+finishTimeId+"_label\\]").css("border-color", "red");
    }
    else {
      //set back to default border color:
      $("#form\\["+gridId+"\\]\\["+i+"\\]\\["+finishTimeId+"_label\\]").css("border-color", "");
    }    
  }
Want to create your own meme coin?

In the world of cryptocurrencies, a unique and exc[…]

The market for cryptocurrencies is demonstrating a[…]

What's SAP FICO?

Embarking on a dissertation can be one of the most[…]

Hello. For rental housing, there are software solu[…]