Check if a variable exists

Post any question you may have in regards to GoAnywhere Director and let our talented support staff and other users assist you.
13 posts Page 2 of 2

Support_Rick

Support Specialist
Posts: 590
Joined: Tue Jul 17, 2012 2:12 pm
Location: Phoenix, AZ

Post by Support_Rick » Tue Jan 05, 2016 12:38 pm
Andrew,

This is executing as designed. Any value you have defined in a parent that is modified in a child with the "returnUserVariables=true" will do just that ... return the updated value from the child.

What I normally do in this case is to define variables for specific reasons then return those values for that instance.

Examples: ftpError, ftpErrorMsg, sftpError, sftpErrorMsg, etc...
Code: Select all
[MyParent]

setVar:  ftpError=0
setVar:  ftpErrorMsg=emptyString

CallProject MyChild -- returnUserVariables=True
Parm ftpError = ${ftpError}
Parm ftpErrorMsg = ${ftpErrorMsg}

If ${ notEmpty( ftpErrorMsg ) }
   ... do my Error Routine here ...
   exitModule
endIF
Code: Select all
[MyChild]

Parm ftpError = "0"
Parm ftpErrorMsg = ""

FTP file to Resource (onError -- Setvar:ftpError=1)

If ftpError > 0
   setVar:  ftpErrorMsg=${system.job.error}
endIF
Rick Elliott
Lead Solutions Consultant
(402) 944.4242
(800) 949-4696

atarrant

Posts: 10
Joined: Tue Mar 27, 2012 7:59 pm

Post by atarrant » Tue Jan 05, 2016 1:53 pm
Yeah, that brings up another point in that it would be nice if we could selectively return only some of the variables to the Parent Project instead of an all or nothing setup. That's a bit off topic though and perhaps something for another post.

Anyway my point is that if we had something to check for the existence of variables then we would not need to initialize them to a blank value everywhere just so we can check them later to see if they have actually been used. So it would be a nice feature to add.

Support_Rick

Support Specialist
Posts: 590
Joined: Tue Jul 17, 2012 2:12 pm
Location: Phoenix, AZ

Post by Support_Rick » Tue Jan 05, 2016 2:58 pm
Send in an enhancement request to [email protected] and see about getting it added to a future release. That's always an option.
Rick Elliott
Lead Solutions Consultant
(402) 944.4242
(800) 949-4696
13 posts Page 2 of 2