AnsweredAssumed Answered

BUG?? Local variables not always local.

Question asked by electric_soul on Feb 3, 2011
Latest reply on Feb 7, 2011 by electric_soul


BUG?? Local variables not always local.


I wrote a function 'eval.error' to help me deal with error messages.


eval.error (

                        "table01::isScrewed    ==>Somebody stepped in crap!";
                        "customer::hasPhone    ==>Mr X has a phone!"


What happens is, the string to the left of "==>" gets evaluated and if it returns TRUE. Then the message on the right of "==>" will be appended to a variable called $error. Let's say that both values, that are being passed to the eval.error function return a mesage. Then the variable $error would contain 2 values.

$error = "Somebody stepped in crap!Mr X has a phone!"

Now......... this function can be used in a script. The more often you use this function, the more might be appended to $error. At the end of the script, the variable $error contains all the errors that occured in a script, and when the scripts exits the variable $error will be deleted, like any other good old local variable.


When I use the function in a table field, something different happens. I have 2 different fields. Both are calculation fields, and both use the function eval.error. What happens is that they share the variable $error. Now is that suppose to be like that? Is it a bug? This sucks ;)