|Late resolve problem [message #891833]
||Tue, 26 June 2012 08:31
| Steve Petruzza
Registered: June 2012
I've to use late resolve to get a Struct that is not jet created, I'm doing like this:
var type := outModel->late resolve(DDSTypes::Struct)->any(t | t.name = self.eReferenceType.name)
But I'm getting the following warning: "The result of ''late resolve'' must be assigned to a property or non-local variable to execute as deferred assignment"
And in the end nothing will be resolved...
What I'm doing wrong? What is the right way to do it?
[Updated on: Tue, 26 June 2012 08:34]
Report message to a moderator
|Re: Late resolve problem [message #892380 is a reply to message #891833]
||Wed, 27 June 2012 23:16
| Alan McMorran
Registered: July 2009
My understanding of the late resolve is that it will wait until the
transformation is complete then go back through and resolve up all the
late resolves that have been deferred. Now I may be incorrect but I
suspect there may be two potential problems here:
1. As Ed has already pointed you're assigning to a local variable which
will, in the execution process, be null/undefined if you try and use it
later in the code so it's giving an error
2. You're running another operation on the late resolved object, in
this case the any function.
I tend to use late resolves to only assign references to objects and
I've not tried having subsequent operations on the resolved object, but
it wouldn't surprise me if the engine didn't deal with this. If you
think about it it would mean that as well as keeping track of the late
resolves it would also have to keep track of the current state of the
mapping at that exact point so it could then call the operation with
whatever variables you refer to. And not just the variables, but their
state at that point since they may have been subsequently modified… I
doubt this would be easy/possible for all conditions
If I need to do this I either alter my mapping order to make sure I can
use a non-late resolve or, if I can't do that and I know the mapping
that will be used, I explicitly call the mapping function.
Of course this is my understanding of how it works, so I may be wrong! :-)
On 2012-06-26 08:31:48 +0000, Steve Petruzza said:
> Hi everybody,
> I've to use late resolve to get a Struct that is not jet created, I'm
> doing like this:
> var type := outModel->late resolveone(DDSTypes::Struct)->any(t | t.name
> = self.eReferenceType.name);
> But I'm getting the following warning: "The result of ''late resolve''
> must be assigned to a property or non-local variable to execute as
> deferred assignment"
> And in the end nothing will be resolved...
> What I'm doing wrong? What is the right way to do it?
Powered by FUDForum
. Page generated in 0.02818 seconds