Tips  |  Documentation  |  Archive
Unusual use of functions in DataWindow expressions
 
  When executing DataWindow expressions PB searches for the function
   in the following order:
   
   1. Functions defined in DataWindow Painter's are viewed
   2. User-defined global functions are viewed
   3. Global system functions are viewed
   
   Therefore, you can use not only those functions that exist
   in the "Modify Expression: Functions list box."
   
   For example, the following expression emulates an animated picture:
   
   Bitmap (CASE (mod (cpu (), 200)
   WHEN IS <= 50 THEN 'file1.bmp'
   WHEN IS <= 100 THEN 'file2.bmp'
   WHEN IS <= 150 THEN 'file3.bmp'
   ELSE 'file4.bmp'))
   
   Or, for example, in the report it is necessary to display a numerical value in a string
   format (for the sum of attendants, for example). That's just for a calculated field in the expression
   write f_sum_to_string (ld_sum), where f_sum_to_string is a custom function
   converting a number to a string equivalent.

   Moreover, using this fact, you can create a set of macros that
   are not known in advance and must be performed in RUN-TIME !!!
   
   1. Collecting a command line or ... in ls_command
   2. dw_1.Describe ("Evaluate ('" + ls_command + "', 1)")
   
   You can also use datastori instead of datawind.