Re: displaying a calulated value dynamically
Posted in 1997
Nelson Fredsell wrote: > > I'm trying display the sum of multiple MONEY type columns as the user > enters the values during ADD or UPDATE processes. I want the > calculated value to change AFTER FIELD on any of the entered values. > > function input_rec( appl_rec, mode ) --mode being "ADD" or "MODIFY" > ... > input by name appl_rec.* > ... > after field col1 > call sum_assets( appl_rec.* ) > > after field col2 > call sum_assets( appl_rec.* ) > > ... > end function > > The sum_assets () function should add 6 amounts which may or may not > have values (ie. could be null) The result would be displayed to a > formonly field on the form. > You've almost got it. sum_assets() would look something like: FUNCTION sum_assets( appl_rec ) DEFINE appl_rec RECORD ... LET appl_rec.total = 0 IF appl_rec.a IS NOT NULL THEN LET appl_rec.total = appl_rec.total + appl_rec.a END IF IF appl_rec.b IS NOT NULL THEN LET appl_rec.total = appl_rec.total + appl_rec.b END IF ... DISPLAY BY NAME appl_rec.total END FUNCTION > Thanks much, > Nelson > Nelson Fredsell > Cornerstone Capital > Atlanta, GA > nfredsel@cornercap.com -- //////////////// ======================================================= ////////// // Dennis J. Pimple Informix Software, Inc. ////// / /// Principal Consultant 6300 S Syracuse Way Ste 205 ///// // //// dennisp@informix.com Englewood CO 80111 //// // ///// /// // ////// recept: 303-850-0210 // // /////// direct: 303-740-5611 Opinions expressed are mine, / /////////// fax: 303-779-4025 and do not necessarily //////////////// http://www.informix.com reflect those of my employer