$ 0 0 Hi Try like this,whileprintingrecords;numbervar x := x + Maximum (MISLHIST.qty},{MISLHIST.itemId});