Expression text parsing change in version 4.2

Top  Previous  Next

In order to correct a problem with "escape sequence" parsing in text expressions, a change had to be made which might impact existing expressions.

 

NOTE: This only affects the Advanced Customizations such as Queries, Events, Dialogs, etc. that you might have added yourself,  so this change won't affect most users.

 

The change is that escape-sequences like \r and \n in quoted text are now converted in the parsing stage rather than the execution stage.  Thus any text variables, data fields, etc. are considered already converted when passed to the functions MessageBox and SendMail (these are the only two functions that this directly affected, at least for the \r and \n character escapes).  The primary effect of this on existing code is that if a backslash character is used in nested quotes (either for escapes or for other things like file paths), it must be double-escaped now.

 

Here is an example -- in previous versions, this expression would work:

 EvalQ( 'MessageBox("First line \n Second line")')

 

Now in version 4.2, the parameter 'MessageBox(...)' inside EvalQ is parsed as quoted text before execution by EvalQ, so the \n is converted before parsing the parameter of the MessageBox function and the resulting line feed would break the expression (a line feed signals the end of an expression).

 

In version 4.2 and later, you need to change it to have two backslashes so that the "\\" is converted to "\" :

 EvalQ( 'MessageBox("First line \\n Second line")')

 

Thus after parsing first set of quotes it will result in the correct expression:

 MessageBox("First line \n Second line")

 

And then of course the text will be given to MessageBox with a proper line feed in it (\n is converted to a line feed), resulting in 2 lines of text in the message box.

 

In summary, if you have any text in expressions that contain backslash characters, and if the expression contains more than one level of quotes, you need to double up the backslashes for each level of quotes.

 

 


Page URL http://CampgroundMaster.com/help/expressionparsingchangein4.html

Campground Master Home