PowerBuilder ‘Gotcha’ – Invalid Expression Error Message

Posted on Friday, August 31st, 2012 at 6:58 pm in

So customer support calls regarding an issue a client is experiencing on a periodic basis. The receive an error ‘Invalid Expression’. To make things worse they get a series of these messages popping up and eventually the application crashes. Great.

So we look at the datawindow object on the application window they are having issues with. Must be something in an expression on the window which, when combined with some type of unusual data, results in a bad expression. The multiple messages comes from the window being refreshed on a periodic basis and, as long as the bad data exists, we get further messages.

Turns out there is nothing wrong with the datawindow or any of the expressions on it. The timer on the window was issuing a Find on the datawindow using data retrieved by some other datastore. Turns out a column used in the find was a descriptive column and the data contained a single quote. That caused the find string to be messed up resulting in the error.

Moral of the story is to check strings inserted into find expressions for quotes and insert a tilde to escape them (unless you don’t want to allow quotes in your strings in the first place).

You might also be interested in

Top