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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Returning multiple types from 1 function

Status
Not open for further replies.

demchak

IS-IT--Management
Jun 29, 2001
36
US
I am trying to set up a parameter field so the user can select how they would like a report sorted.

The issue is the fields they want to choose from are
Account name (text)
Estimated close date (date)
%chance to close (numeric)
estimated value (numeric)
total fees (numeric)

The selection works if I add in just the numeric fields but errors when i try to add in the account name.

I tried converting the numerics to text but it messes up the sort order.

Any ideas on how to do this?
 
The solution is to convert the numerics to text in a manner that doesn't hurt the sort order.

ToText() and Cstr() have various formatting options (see online help) to ensure the resulting string behaves the way you wish.

Cheers,
- Ido

CUT, Visual CUT, and DataLink Viewer:
view, e-mail, export, burst, distribute, and schedule Crystal Reports.
 
Ive tried to use the formatting commands but they seem to be more for changing the way the results are displayed...commas, #of digits, decimal point etc..

My problem is that if i try to sort the numbers 1,5,10
I get
1
10
5

because it is putting them in alphabetic order not number.

If im missing something please let me know but i cant see anything in the parameters to totext() to help this problem
 
Use:
----------------------------
Cstr({numeric_field}, "00")
----------------------------

This will result in:
01
10
05

Cheers,
- Ido



CUT, Visual CUT, and DataLink Viewer:
view, e-mail, export, burst, distribute, and schedule Crystal Reports.
 
Ido is right. For your example, you would use:

totext({table.number},"00")

This would give you:

01
05
10

...which would sort correctly.

-LB
 
I think i got it. I was able to get it to sort in the correct order by converting tostring and forcing spaces into the begining of the string.

ex

If {?SortOrder} = "Fee Amount"
Then totext({OPPORTUNITY_PRODUCT.FEE_AMOUNT},"##########")

my numbers now sort in the correct order
1
5
10

Thanks for your help
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top