AnsweredAssumed Answered

how do you handle null value in Groovy?

Question asked by JamesTran3921 on Mar 18, 2014
Latest reply on Apr 15, 2014 by Pavan_Sirasanambedu
My process step is to increment a value like count=count+1. I've been told to use the sample Groovy script available on this forum. The problem I ran into is I don't know Groovy and I keep getting this null error handling message. How do you increment a process value? Now I'm resorted to the archaic branch step followed by set properties steps; it's really stupid.

Below is the code sample I'm using:
Thanks for your insights,
     import com.boomi.execution.ExecutionUtil; 
     import java.util.logging.Logger;
     Logger logger = ExecutionUtil.getBaseLogger();
     // Retrieve current Process Property value
     propValue = ExecutionUtil.getExecutionProperty("count");
  "initial count= " + propValue);
     // Convert string value to int to do math
     int intValue = Integer.parseInt(propValue);
     // Increment value by 1
     intValue = intValue + 1;
     // Convert int value back to String
     propValue = Integer.toString(intValue);"final count= " + propValue);
     // Set the process property
     ExecutionUtil.setExecutionProperty("count", propValue);