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

Group Sorting in CR 10 with Range Criteria

Status
Not open for further replies.

jogarza

Programmer
Dec 12, 2003
1
US
I am having a problem sorting data when selecting a range. For example: using these part numbers
00A-DTA1-AQUA
02-JFPA-K81
021-JF-ABP
022-AC-BUOY3L
and printed in ascending order they print fine.

However, when selecting a range, say 00A-DTA1-AQUA thru 022-AC-BUOY3L the 02-JFPA-K81 part is not included - CR considers it out of the range.

It appears that the select range feature in CR treats the "-" as a higher value that "A", 1 and 2.

Is there a solution?



 
I think you should try to normalize the data at least for the selection formula, where you would test the length of each section and pad it as necessary to get the correct sort. Something like this:

stringvar x := {table.partno};
stringvar array y := split(x,"-");
stringvar z := "";
if len(y[1]) < 3 then
z := z + y[1]+ replicatestring("0", 3-len(y[1]))+"-" else
z := z + y[1] + "-";
if len(y[2]) < 4 then
z := z + y[2] + replicatestring("Z",4-len(y[2])) +"-" else
z := z + y[2]+"-";
if len(y[3]) < 6 then
z := z + replicatestring("Z",6-len(y[3])) else
z := z + y[3];
z

Then use this formula for the range selection (without changing the actual field in the report). This will be a slow report though, since this conversion will all happen locally.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top