Expand my Community achievements bar.

FormCalc Error Handling?

Avatar

Level 2

Is there any way to implement error handling into a formcalc function?

I'm using a Get function to call a file from a web server... It works if there is an internet connection but returns a formcalc error if no connection is available. I would rather return a more discriptive message to the user if no connection is available. I can't seem to find any error handling in any formcalc documentation.

Im just looking for a simple if/then statement to address this... Help is appreciated.

1 Reply

Avatar

Level 7

Not sure--just guessing. But..

If you make a variable = to your connction then test the variable to see if it exists. Something like:

     var testConnect = xfa.host.connect

          if (HasValue(testConnect) == 0)     then

            xfa.host.messagebox("There seems to be a problem establishing a data connection with the server. Please verify that Internet access is available             and try again.","Data Connection Failed")

          endif

Granted, this doesn't prevent the generic error message from being displayed, however it does give the user a clue as to the type of problem.  And, like I said, my script above is probably not correct--its only intended as an idea or possible starting point--not an answer. Its just a guess.

Stephen