How to check is variable exist

Post any question you may have in regards to GoAnywhere MFT and let our talented support staff and other users assist you.
If you need a quicker response, please create a support ticket via the customer portal my.goanywhere.com or contact our support team by email at [email protected].
4 posts Page 1 of 1

JamesLSEG

Posts: 6
Joined: Tue Feb 16, 2016 11:05 am

Post by JamesLSEG » Thu Feb 18, 2016 6:45 am
How do I check if variable doesn’t/does exist on a project.

e.g. If variable exist do something else continue.

James

Support_Rick

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

Post by Support_Rick » Thu Feb 18, 2016 9:15 am
James,

It's unusual to utilize a variable that doesn't exist. But, depending on the situation, you could trap for the existence of the variable.

For example:
Code: Select all
SetVar DNE=0
SetVar MyNewVar = ${VarThatDoesnotExist}.csv (OnError setVar DNE=1)
If DNE gt 0
   ** Correct Missing Variable issue here **
EndIF
Rick Elliott
Lead Solutions Consultant
(402) 944.4242
(800) 949-4696

JamesLSEG

Posts: 6
Joined: Tue Feb 16, 2016 11:05 am

Post by JamesLSEG » Thu Feb 18, 2016 11:09 am
Thanks for the information.

We are trying to make monitor project able to be rerun.

When the project is run by monitor it logs the files it is meant to get to the database and removes them once downloaded successfully. If it the project fails when you rerun the project if ${files} variable is not found it populates a rowset from database log and then runs the steps to get and and remove from db log.

The issue we have is if the monitor job fails it is hard to rerun and will never kick off again.

James

Support_Rick

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

Post by Support_Rick » Thu Feb 25, 2016 9:29 am
James,

This would be handled pretty much the same way...

Monitor generates filelist -> MyMonFileList

Project uses MyMonFileList to process files identified when monitor executes.

Inside Project, do something like:

variable MyMonFileList = "" (as a parameter)
(Note: Any value passed in from Monitor would override this)
...
If isEmpty(MyMonFileList) -> CreateFileList (MyMonFileList) with (blah blah blah)
...
ForEach ${MyMonFileList}
(etc...)

==========
What this accomplishes is .. if the project is kicked off by the Monitor, it passes the FileList var in as needed (thus MyMonFileList would not be empty)

If you execute the project from Project access ... then, MyMonFileList is empty (Thus triggering the If statement to generate the MyMonFileList before continuing)
==========

Hopefully, this will help you along ...
Rick Elliott
Lead Solutions Consultant
(402) 944.4242
(800) 949-4696
4 posts Page 1 of 1