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

Sorting

Status
Not open for further replies.

teferi2002

Technical User
Sep 24, 2005
81
US
Hi everybody;
I am encountering a problem trying to sort a report using different fields. I have a string parameter and based on the customers’ selection the sort field will be assigned. The problem is one of the fields that I am trying to assign to the sort field is a Number field. The formula is giving me an error message because the rest of the fields are text fields. When I changed the number field to text, it doesn’t sort it right. Is there am easier way to do this.

Here is the formula field that I am trying to assign

case 'PERMITNUMBER' : cstr({WMS_MBP_PERMITS.PERMIT_NUMBER})


select uppercase({?sortfield})
case 'SUBAREA' : {WMS_MBP_PERMITS.SUBAREA}+{WMS_MBP_CONTROL_SECTIONS.TRUNK_HIGHWAY}+mp+cstr({WMS_MBP_PERMITS.PERMIT_NUMBER})+{WMS_MBP_CONTROL_SECTIONS.CONTROL_SECTION}
case 'CONTROLSECTION' : {WMS_MBP_CONTROL_SECTIONS.CONTROL_SECTION}+{WMS_MBP_CONTROL_SECTIONS.TRUNK_HIGHWAY}+mp+cstr({WMS_MBP_PERMITS.PERMIT_NUMBER})+{WMS_MBP_CONTROL_SECTIONS.CONTROL_SECTION}
case 'BEGREFPOINT' : {WMS_MBP_PERMITS.MILE_POINT_BEGIN}
case 'ENDREFPOINT' : {WMS_MBP_PERMITS.MILE_POINT_END}
case 'PERMITNUMBER' : cstr({WMS_MBP_PERMITS.PERMIT_NUMBER})
default: {WMS_MBP_CONTROL_SECTIONS.TRUNK_HIGHWAY}+mp+cstr({WMS_MBP_PERMITS.PERMIT_NUMBER})+{WMS_MBP_CONTROL_SECTIONS.CONTROL_SECTION}
 
State your software version and the database type.

change your cstr to something like:

picture(cstr(WMS_MBP_PERMITS.PERMIT_NUMBER},0,""),'000000000000000000')

-k
 
I think that could be simplified to:

cstr(WMS_MBP_PERMITS.PERMIT_NUMBER},'000000000000000000')

...where the number of zeros is the maximum number of digits in the permit number.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top