Changing a variable in an eval statement
When you change a variable within an eval statement that is itself inside a function, the changed value is disposed of past the end of the eval statement. Is there a way to circumvent this behavior to let an eval statement change a variable and use the new value?
Here's my situation: I want to compare information that appears in a web table to information from a FoxPro query. However, some information is formatted a bit differently when printed to the table than it comes out of the query. For instance, on field represents a monetary value, so that script needs to add a "$" to the front of the expected result. My solution was to have a filter variable used in an eval statement to the effect of:
eval_can't_be_written_on_this_forum("expected = "filter);
Where filter might be a call to a function or something as simple as "\"$\"expected".
Re: Changing a variable in an eval statement
Never mind; I found a solution. If you find yourself in the same situation in the future, here it is: I moved the expected variable outside of the function and made it a static variable of the test script. This allowed the eval statement to change it. It's a bit messy, since this variable really only belongs in that one function, but it will have to do. Thanks for reading.