My financial users would like to be able to sort their reports various ways. Some of the fields are string, some date and some numeric.
I've made a parameter {?sortfield}with a drop box with the field names.
I have a formula called {@sortby}that gets the correct field, using "name" as a default:
if {?sortfield} = "Tran Date" then totext({LEDGER.ENTRY_DATE})else
if {?sortfield} = "Tran Type" then {LEDGER.LEDGER_TYPE}else
if {?sortfield} = "Status" then {LEDGER.STATUS}else
if {?sortfield} = "Amount" then totext({LEDGER.AMOUNT}) else
if {?sortfield} = "Tran Description" then {LEDGER.DESCRIPTION}else
if {?sortfield} = "Name" then {@name} else
{@name};
Then I use {@sortby} as my sort order.
My problem, obviously is the date and amount fields being non-string. the date sorts alpha and the amount ignores negatives.
Any ideas on how to get around this?
I've made a parameter {?sortfield}with a drop box with the field names.
I have a formula called {@sortby}that gets the correct field, using "name" as a default:
if {?sortfield} = "Tran Date" then totext({LEDGER.ENTRY_DATE})else
if {?sortfield} = "Tran Type" then {LEDGER.LEDGER_TYPE}else
if {?sortfield} = "Status" then {LEDGER.STATUS}else
if {?sortfield} = "Amount" then totext({LEDGER.AMOUNT}) else
if {?sortfield} = "Tran Description" then {LEDGER.DESCRIPTION}else
if {?sortfield} = "Name" then {@name} else
{@name};
Then I use {@sortby} as my sort order.
My problem, obviously is the date and amount fields being non-string. the date sorts alpha and the amount ignores negatives.
Any ideas on how to get around this?