title: Using groovy script as a value for property in SoapUI
body: <p>A am not familiar with soapUI and groovy so maybe somebody can help me. I tried to use this property definition to generate unique id</p>
  
  <pre><code>${=((0..&lt;20).collect{['a'..'z','0'..'9'].flatten()[new Random().nextInt(['a'..'z','0'..'9'].flatten().size())]}.join())}
  </code></pre>
  
  <p>But I get an error because this expression contains nested curly braces and I can't find the way to escape them. Maybe somebody know the way? </p>
  
  <p>Thanks in advance. </p>
  
  <p><strong>Updated</strong>. I changed the script and now it works fine in script window in SoapUI.</p>
  
  <pre><code>new GroovyShell().evaluate("(0..&lt;20).collect {[\u0027a\u0027..\u0027z\u0027,\u00270\u0027..\u00279\u0027].flatten()[new Random().nextInt ([\u0027a\u0027..\u0027z\u0027,\u00270\u0027..\u00279\u0027].flatten().size())]}.join()"
  </code></pre>
  
  <p>I replaced single quotes with their unicode code because of xml validation fails.</p>
  
  <p>But when I try to use it as value for property, it throws and error.</p>
  
  <pre><code>${=new GroovyShell().evaluate("(0..&lt;20).collect {[\u0027a\u0027..\u0027z\u0027,\u00270\u0027..\u00279\u0027].flatten()[new Random().nextInt ([\u0027a\u0027..\u0027z\u0027,\u00270\u0027..\u00279\u0027].flatten().size())]}.join()"}
  
  startup failed: Script183.groovy: 1: unexpected char: 0xFFFF @ line 1, column 136.    .flatten()[new Random().nextInt([\u0027a
  </code></pre>
  
  <p>I would think that I have a syntax error in my script, but it throws an error only in when I use it like a property. Does anybody know how to fix this? If I could use it as property, I could make happy a lot people ;) as they just need to use the name of property and not to call any scripts.</p>
  
  <p><strong>Updated</strong>. I deleted (0..&lt;20).collect part and now it is ok, but it generates only one symbol. So the problem somewhere here.</p>