SET SAFETY OFF SET SESSION Crosstab Aging COMMENT ************************************************************************** ***** CROSSTAB AGING ***** ***** This script ages by calculating the number of ***** days outstanging and applys a set of aging ***** periods while subtotaling the amount. The data ***** is subsequently crosstabulated by customer number. ***** ***** The default aging period are: 0-30 Days ***** 31-60 Days ***** 61-90 Days ***** 91-120 Days ***** 121+ ***** ***** Feel free to Modify as needed! ***** ***** Developed by Randall Shane, PhD ***** Base XVI, LLC ***** www.basexvi.com ************************************************************************** ACCEPT "Choose Table:" FIELDS "xf" TO v_table OPEN %v_table% ACCEPT "Choose Date field:" FIELDS "D" TO v_field ACCEPT "Enter the date to age from as YYYYMMDD:" TO v_cutoff ACCEPT "Choose the Customer field:" FIELDS "C" TO v_custno ACCEPT "Choose the Amount field:" FIELDS "N" TO v_amount DELETE FIELD age_in_days OK DEFINE FIELD age_in_days COMPUTED AS "Age in;Days" "0-30 Days" IF BETWEEN( AGE( %v_field%, `%v_cutoff%`), 0, 30) "31-60 Days" IF BETWEEN( AGE( %v_field%, `%v_cutoff%`), 31, 60) "61-90 Days" IF BETWEEN( AGE( %v_field%, `%v_cutoff%`), 61, 90) "91-120 Days" IF BETWEEN( AGE( %v_field%, `%v_cutoff%`), 91, 120) "121+ Days" IF AGE( %v_field%, `%v_cutoff%`) > 120 "Unknown Range - check your data & parameters" CROSSTAB ON %v_custno% COLUMNS age_in_days SUBTOTAL %v_amount% COUNT TO Crosstab_Aging.FIL OPEN DELETE ALL OK SET SAFETY ON