Symptom
- How to format the parameter list of values from (1,200 1,201) to (1200 1201), where 1,200 and 1,201 is stored in the database as a string value.
Environment
-
Crystal Report 2008
-
Crystal Report XI Release 2
-
SQL Server
Reproducing the Issue
-
- Create a table (e.g. job) with say Two Field in it (e.g. job_number and job_name).
- The Datatype of both the Field should be String, but for job_number add only Number Value's.
- Add a Command Object in Crystal Report much like the one given below
-
- Select cast(job_number as INT) as job_id,job_name from the job;
- Create a Dynamic Parameter based on job_number.
- You will see that a Comma is being added in the parameter value which is appearing in Parameter Prompt Window.
- Need to Eliminate the Comma’s coming in the Parameter Values and as well as need to Sort the Values too.
Resolution
-
- Modify the command object as shown below:
-
- SELECT JOB_NUMBER,CAST(JOB_NUMBER AS INT) as JOB_NUMBER_int, FROM JOB.
- Modified the SQL Query to show the INT Casted Value of JOB_NUMBER as JOB_NUMBER_int as well as to show the char value of JOB_NUMBER in the Command Object.
- Used JOB_NUMBER_int as a Value Field and JOB_NUMBER as Description Field in the Parameter Window.
- Performed the Sorting on Value field in Parameter Window with option as "Descending by value" and selected option for "Prompt with description only" as TRUE.
- You can see the parameter values without commas and the values are also sorted.
Keywords
Crystal Reports, CR, List of Values, LOV, sort, Original Order, Commas in Parameter Value , KBA , BI-RA-CR , Crystal Reports designer or Business View Manager , How To
Product
Crystal Reports 2008 V1 ; SAP Crystal Reports XI R2
SAP Knowledge Base Article - Public