Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Hmmm, not quite sure what the problem is, but I do find something curious. In your first block, you use the following:</p> <pre><code> def sample = currA.b?.c </code></pre> <p>According to the classes you've created, currA.b is a Collection of Bs, not a single one. Therefore currA.b?.c would be a Collection of Collections of C class instances, one Collection for each of the Bs in currA.b</p> <p>I'm not sure what would happen if currA.b was empty... given the safety operator, which equates empty with null (via GroovyTruth), I'd say sample would be null.</p> <p>None of this helps determine why the line you specify generates an error, though. Perhaps you can show us what the error is? Is it an NPE or some other?</p> <p>Looking at this more, It also looks like you're missing the "to" function call:</p> <pre><code>on("event") { intraEvent code }.**to** "eventHandlerAction" </code></pre> <p>Perhaps the error you're seeing is the result of this?</p> <p>Seems not.</p> <p>Ok, only other thing I can think of is that some time ago (v1.1 I think), they made it so you have to use "this." a lot more inside flow actions. Essentially, in order to access controller class-level objects and methods, you need to put "this." in front of the access to them. Say you wanted to put that intraEvent code you've got into a method:</p> <pre><code>def goGetC() { def anId = params.id def currA = A.get(anId) def sample = currA.b } </code></pre> <p>In order to call that method from your event code, you'd have to use:</p> <pre><code> someState { on("next") { this.goGetC() }.to ("wherever") } </code></pre> <p>If you tried to call goGetC() without the "this.", you'd instead be ending your eventhandler with the event "goGetC". I'm not sure if your simplification of your real code is hiding a similar case or not, and I'm still not sure what error exactly you're getting, but this was something that bit me a while ago and it's Flow specific. Hope this helps.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload