AnsweredAssumed Answered

I'm getting an error when trying to remove white space in a scripting step within a data process step.

Question asked by AdamBlakely4561 on May 5, 2014
Latest reply on May 6, 2014 by richard_moon
My script is below.

import java.util.Properties;
import java.io.InputStream;
import com.boomi.execution.ExecutionUtil;

// Retrieve a Dynamic Process Property value
def myValue = new StringBuffer(ExecutionUtil.getDynamicProcessProperty("FileName"));

// Removing spaces in the file name
myValue.replaceAll("\\s+","");

// Set a Dynamic Process Property value and persist the dynamic property by setting the Boolean to "true"
ExecutionUtil.setDynamicProcessProperty("NewFileName", myValue.toString(), false);

for( int i = 0; i < dataContext.getDataCount(); i++ ) {
  InputStream is = dataContext.getStream(i);
  Properties props = dataContext.getProperties(i);

  dataContext.storeStream(is, props);
}

I'm getting the below error.

No signature of method: java.lang.StringBuffer.replaceAll() is applicable for argument types:  java.lang.String, java.lang.string) values: {"\s+",""} (in groovy script); No signature of method: java.lang.StringBuffer.replaceAll() is applicable for argument types:  java.lang.String, java.lang.string) values: {"\s+",""}

I'm assuming it is having a hard time with the regex so i also tried (" ","") as my values for the replaceAll() function.

thanks,
Adam

Outcomes