1

I have noticed a change in behaviour between PB12 and PB12.5 (both patched). I have quite few datawindows with global functions on them. In previous versions of PB these functions only got fired on when the datawindow got focus (getfocus event) - which suited the application perfectly.

The functions now seem to get fired all the time (it seems to be on the mousemove event - but I can't be sure).

Has anyone else noticed the same - and is there any solution? Thanks

Peter
  • 11
  • 2
  • I recall that with PB 11.5 I had to do something like hide/show the DataWindow to force it to reevaluate. I wouldn't be surprised if more things cause it to reevaluate. Where are the expressions that call the global functions? Are they in computed fields or object properties? – Hugh Brackett Dec 03 '12 at 17:20
  • Global functions in datawindows are generally a *bad* idea. They can usually be modelled out by adding extra columns into the result set, and writing expressions on those hidden columns. What does your global function do? – NoazDad Dec 03 '12 at 20:03
  • The global functions are in computed fields. They tend to be fairly simple sql commands (such as looking up a description for something, or a translation to another language (application has lookup tables for translations)). – Peter Dec 04 '12 at 11:58

1 Answers1

1

Actually, I've noticed quite the opposite: that they've always fired more often than just GetFocus. Given that expressions can include values like FirstOnPage and LastOnPage, they'd have to.

Advice from Powersoft/Sybase/SAP has always been to use global functions in expressions cautiously, as they fire very often. (I explicitly remember hearing that advice at one of the first PowerBuilder conferences in San Diego/Coronado, which would put the advice near the PB3 release date.) If PB12 only fired on GetFocus, that was probably a very version-specific bug, as it would have broken many apps, so it would have been fixed very quickly.

Good luck,

Terry.

Terry
  • 6,160
  • 17
  • 16
  • Thanks for the replies. I use them sparingly, I never use them on reports. I only use them in a situation where a user is modifying a single row on a datawindow. In the case that I noticed the problem there is a large dw for data entry. The user can print a form based on this dw. Another window pops up to handle the printing options. When the user returns to the dw a function on the dw fires to return the "date and user name" the form was last printed for. It needs to run a DB query to get this info, it used to fire once, it now fires all the time - causing lots of unnecessary db traffic. – Peter Dec 04 '12 at 11:54
  • Should I do away with the global functions on the dw altogether and code them in the activate or getfocus events instead? – Peter Dec 04 '12 at 11:56
  • Activate may be too often too, including times like times another app grabs focus from yours (I find email notifiers and other "background" processes are notorious for this). From the description, why not just do a Modify() when the print dialog is closed? Do it right, and you can even narrow it down to times the user actually prints, excluding times that he cancels out of the dialog. – Terry Dec 04 '12 at 16:32