Home » Uncategorized » ViewEditor Bug
Apr
13

ViewEditor Bug

I received a bug report this week for ViewEditor Professional that took a little time to track down. I don’t have time to immediately fix it so I want to pass this along to the developers with two simple workarounds to use until I can figure out the best solution.

The bug is only revealed under a specific circumstance and has likely been a bug since ViewEditor Professional was originally written back in 2002. The bug shows itself when you save the view you are working on. The save process verifies the view’s SQL code is valid and reports any problems with the SQL code. During this process all view parameters are substituted using the VFP STRTRAN() function. Depending the substitution sequence of the view parameters and the names of the view parameters, an incorrect substitution occurs. The problem only happens when you have two view parameters starting with the same characters.

?vp_lActive = .F.?vp_lActiveArchive = .T.

SELECT cCustomerID, cCustomerName ; FROM Customer ; WHERE ?vp_lActive = .T. ;    AND ?vp_lActiveArchive = .T.

If vp_lActive is STRTRAN’ed first you see the validation code after the substitution to be:

SELECT cCustomerID, cCustomerName ; FROM Customer ; WHERE .F. = .T. ;    AND .F.Archive = .T.

The two workarounds (use one or the other):

  1. Do not name your view parameters starting with the same characters.
  2. Shut off the validation process when saving views by unchecking the Validate SQL checkbox on the SQL page.

If your views give you an error when you are saving them you can click on the Show SQL Validation Code button to see what the ViewEditor uses as the validation code. This is how I revealed what happened with my customer’s view. She knows the view is valid and has decided to shut off the validation until I can the validation substitution of view parameters.

, ,

Add reply