Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sorting Formula?

Status
Not open for further replies.

jdaily

Technical User
Jan 19, 2004
53
US
Hi all,

I am running Win98 w/ Crystal 8.5.

Question:

Is there a way to create a formula for sorting?

I have a report that has 2 parameters that you have to choose in order to get data.
Param1 is the table.PaymentDate range.
Param2 is the table.FinancialClass.

The data is pulled by these two parameters but the default sort is by a table.ContractID, table.PaymentDt, table.PatientName, table.PatientType, and then table.InsuranceCo. (Sorted in this order)

It is also grouped by table.ContractID.

I want to be able to keep the sorting the way it is BUT for table.FinancialClass in "B" or "P" I want it to sort different. I want "B" or "P" to sort by table.ContractID and then table.PatientType, only.

I would do all this way but the other FinancialClass have to sort to the default way. There are 6 others compared to the 2 I want to sort differently. It was easier to do it this way.

Any suggestions?

Thank you in advance!
 
Since the report is grouped by contractid, the report will always sort by this first.

If you want to change the sortation, you'll need to create a formula to do so and sort by it.

It would work something like:

if parmFinancialClass in ["B","P"] then
table.PatientType
else
table.PaymentDt&table.PatientName&table.PatientType&table.InsuranceCo

The rub here is that you'll need to convert the data types to all be of one type using totext or some such, and maintain proper precision of any numerics.

Since I don't know your data types, I won't guess, but you should be able to figure it out.

-k
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top