Author |
Message
|
ruchir |
Posted: Mon Nov 28, 2011 10:32 pm Post subject: Scope of Reference variable to Environment variable |
|
|
Guest
|
Hi All,
May be this is already asked previously, so i m sorry if i m asking it again, but i hav a small issue about the scope of refrence variable to Environment variable.In my flow i have two compute node. In one compute node i m declaring a reference variable and in the other compute i tried to fetch that value.
I declared a refrence to Enviroment variable in the first compute node as :
Code: |
DECLARE envRef REFERENCE TO Environment; |
Then i stored value in that reference variable as
Code: |
envRef.Header.abc = 'hi'; |
when i m trying to get value of this refrence variable in second compute node it is giving error as follows
Quote: |
The correlation name 'envRef.Header.abc' is not valid.The first element of a field reference must be a valid correlation name, from those in scope. |
Plz me why i m facing this issue and how can i solve this problem.  |
|
Back to top |
|
 |
mqjeff |
Posted: Tue Nov 29, 2011 2:16 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
It's probably as simple as the scope of your DECLARE.
You probably have your DECLARE inside your Compute MODULE. You would need it to at least be at the schema level. |
|
Back to top |
|
 |
ruchir |
Posted: Tue Nov 29, 2011 3:17 am Post subject: |
|
|
Guest
|
Hi mqjeff,
Thanks for the reply.
I got it but environment variable is available in other COMPUTE module in the same flow. So its reference shld also have the same scope. As reference variable is same as the variable to which it is referring , or it has diff functionality.
Plz confirm. |
|
Back to top |
|
 |
mqjeff |
Posted: Tue Nov 29, 2011 3:20 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
The Environment TREE is available in the other compute node.
Your POINTER to the Environment Tree is *not*. Unless you take steps to make it available. By declaring it in the right scope. |
|
Back to top |
|
 |
ruchir |
Posted: Tue Nov 29, 2011 3:37 am Post subject: |
|
|
Guest
|
If POINTER to Environment Tree is not available in other compute node, then how we can share a reference variable between 2 compute node. I tried to declare it outside the COMPUTE MODULE but it is giving SYNTAX error saying :
Quote: |
Identifier "Environment" cannot be resolved |
Plz tell how to declare so that it is in right scope.  |
|
Back to top |
|
 |
mqjeff |
Posted: Tue Nov 29, 2011 3:47 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
Ooo. Interesting twist. I'd forgotten that. I don't think it's possible to declare a reference to nothing, and then later move it somewhere. So you might not be able to declare reference in schema scope and then move it to a valid tree location in the compute module.
Why do you think you need to share the pointer? The tree exists and is immutable between the two nodes. So if you redeclare the reference in both compute modules you achieve the end result. And there's very little extra work - there shouldn't be any noticable performance impact - from doing the declare twice.
Or of course you could move the logic into a procedure and call the procedure from both modules. |
|
Back to top |
|
 |
lancelotlinc |
Posted: Tue Nov 29, 2011 6:32 am Post subject: |
|
|
 Jedi Knight
Joined: 22 Mar 2010 Posts: 4941 Location: Bloomington, IL USA
|
|
Back to top |
|
 |
mqjeff |
Posted: Tue Nov 29, 2011 6:33 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
lancelotlinc wrote: |
Or use solidDB and/or a Singleton. |
 |
|
Back to top |
|
 |
ruchir |
Posted: Tue Nov 29, 2011 10:19 pm Post subject: |
|
|
Guest
|
Hi mqjeff,
Thanks a ton for ur reply
my problem is solved. . I declared the reference again and then got all the values.
Thanks a lot.  |
|
Back to top |
|
 |
|