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

Grouping in Crystal not working

Status
Not open for further replies.

dev1212

Programmer
May 11, 2010
117
US
I have values in the field {Acct.Code}as below

A1
A2
A3
A4
A5
A6
A7
A8
A9
A10
A11

Now when i group on this field i am expecting it to be in sequence like
A1
A2
A3
A4....


But it is grouping as
A1
A10
A11
A2
A3
A4...

What is the fix for this..?




 
dev1212,

Is it always one alpha character then numeric values?

You could use:
Code:
ToNumber(Replace({Acct.Code},Left({Acct.Code},1),""))
this will give you a numeric value in the field.

if you have more than "A" as the alpha component, you will also need:
Code:
Left({Acct.Code},1)
to get the alpha portion.

Create groups on these fields (and supress if needed), you should get the result you seek.

Hope this helps! Cheers!

Mike
---------------------------------------------------------------
"To be alive is to revel in the moments, in the sunrise and the sunset, in the sudden and brief episodes of love and adventure,
in the hours of companionship. It is, most of all, to never be paralyzed by your fears of a future that no one can foretell."
 
If there is always only one character on the left, you could group on this:

val(mid({acct.code},2))

But then display the actual {acct.code} field instead of the groupname.

-LB
 
Thanks LB!

I had pondered Mid()... but forgot that if you leave the number of characters empty it simply will go until the end of the field starting at the position indicated.

Brilliant, as always. [smile]

Mike
---------------------------------------------------------------
"To be alive is to revel in the moments, in the sunrise and the sunset, in the sudden and brief episodes of love and adventure,
in the hours of companionship. It is, most of all, to never be paralyzed by your fears of a future that no one can foretell."
 
Thank you guys for the reply.. it is working fine now
 
For shorter lists you can always group by specified order
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top