Page 1 of 2 1 2 >
Topic Options
#43095 - 04/15/13 03:57 PM passing value to and from SubProcess
Alain B Offline
OL Guru

Registered: 09/30/08
Posts: 101
Loc: Montreal
Hi Is there a way to pass and to retrieve data to a sub process like a function or procedure in programming language?

Top
#43107 - 04/16/13 10:05 AM Re: passing value to and from SubProcess [Re: Alain B]
Olivier J
Unregistered


Hi Alain,

Using the "go sub" task will send your data to a sub process and will automatically be passed the resulting data stream when the sub is done.

If you are enquiring about variables, then you should use jobinfos and/or global variables. Local variables cannot be accessed from a subprocess since there is no way to know what process called it.

Let us know if that answers your questions. Thanks.
Regards,
Olivier

Top
#43112 - 04/16/13 10:50 AM Re: passing value to and from SubProcess [Re: Alain B]
Alain B Offline
OL Guru

Registered: 09/30/08
Posts: 101
Loc: Montreal
Hi Olivier,

I cannot use global variable because there is more than one different process that can go sub the same subprocess at the same time. and i dont want to dupplicate global variable and subprocess for each process.

if I use %1 to %9 will both the subprocess and the process differentiate each one without error?

les say :
processA set %1 to '1234' then 'go sub' getclientemail who set %9 to '1234@email.com'

processB set %1 to '4567' then 'go sub' getclientemail who set %9 to '4567@email.com'

what I want to avoid is having ProcessA for client '1234' with the email of processB '4567@email.com'

Top
#43115 - 04/16/13 11:16 AM Re: passing value to and from SubProcess [Re: Alain B]
Olivier J
Unregistered


Hi Alain,

Yes jobinfos will be thread safe and will not conflict. I would recommend starting with %9 and going down isntead of starting at 1, as jobinfos are used by input tasks and can overwrite what you assigned to them. If your data stream will not come accross any other input task along the way, then you can safely use any of them.

Thanks. Regards,
Olivier

Top
#43116 - 04/16/13 11:19 AM Re: passing value to and from SubProcess [Re: Alain B]
Alain B Offline
OL Guru

Registered: 09/30/08
Posts: 101
Loc: Montreal
ok thanks will try to use %8 and %9

Top
#43160 - 04/18/13 02:20 PM Re: passing value to and from SubProcess [Re: Alain B]
Alain B Offline
OL Guru

Registered: 09/30/08
Posts: 101
Loc: Montreal
Ok I did some test

ProcessA set variable %7 to 'TEST123'
ProcessA GOSUB ProcessB

ProcessB can read %7 has 'TEST123'
ProcessB setvar %8 to 'ABCDEF'
PROCESSB Exit

ProcessA get %8 has ''

So We cann pass value to the sub process but the subprocess cannot send back the information

Top
#43161 - 04/18/13 02:23 PM Re: passing value to and from SubProcess [Re: Alain B]
Olivier J
Unregistered


Hi Alain,

There is an option in the GoSub task to backup job information. Make sure to toggle it and see if the job info returns with the right value. You should definitely be able to receive the job info 8 populated.

Regards,
Olivier


Edited by Olivier J (04/18/13 02:23 PM)

Top
#43162 - 04/18/13 02:29 PM Re: passing value to and from SubProcess [Re: Alain B]
Alain B Offline
OL Guru

Registered: 09/30/08
Posts: 101
Loc: Montreal
Hi Olivier
Already tryed without success

Top
#43169 - 04/18/13 05:12 PM Re: passing value to and from SubProcess [Re: Alain B]
Philippe F. Offline
OL Expert

Registered: 09/06/00
Posts: 1931
Loc: Objectif Lune, Montreal, Qc
Make sure to UNCHECK the "Backup Job Information" option in the GoSub task.

Any changes made to the JobInfos inside the sub will then be propagated back to the calling process.

Obviously, if your Gosub task is inside a branch of the calling process, then you also need to set the same options on the branch itself if you want to access the modified JobInfos from the trunk (or from the parent branch).
_________________________
Technical Product Manager
I don't want to achieve immortality through my work; I want to achieve immortality through not dying - Woody Allen

Top
#43173 - 04/19/13 08:25 AM Re: passing value to and from SubProcess [Re: Alain B]
Alain B Offline
OL Guru

Registered: 09/30/08
Posts: 101
Loc: Montreal
Hi Philippe it worked Thanks

Top
Page 1 of 2 1 2 >