cancel
Showing results for 
Search instead for 
Did you mean: 

Parameter Capturing in CR 2008

Former Member
0 Kudos

Hi experts,

I am using crystal report 2008 and backend database is sql server 2008.

I created a report based on a stored procedure which has a single parameter. For example @ID =?

I am using a view to give the list of value to this stored procedure for example:

{View I am using}

ID           Request Details

1            Submission to customers

2            request for business

3            request in process

4            request pending

…                   ……….

I am using the ID field of view to give the list of values to the @ID parameter of SP.

And I am using the Request Details Field of the view as the description of the List of values.

So when the user runs the report it only shows the description in the list of values to the user which makes it easier for them for auditing purpose.

Is there any way that I can capture the description (Request Details) selected from the list of values on my report.

I know that I can capture the ID field but I want to show the description (Request Details) field on the report as well.  Because if there is no data for the selected ID then it leave my report blank. If I can capture the description then I can show them the values they selected from parameters.

Will appreciate your help.

Thanks in advance.

Accepted Solutions (1)

Accepted Solutions (1)

vitaly_izmaylov
Employee
Employee
0 Kudos

Have you tried "Show Description" :

Former Member
0 Kudos

Hi,

Thanks for your quick response, but i am already doing what you mentioned above. but the thing i am trying to achieve is to get the grab the description selected from the Parameters and show that on the report.

i can grab the ID and show that on the report but is it possible to get the description on the report as well?

i hope that makes sense.

abhilash_kumar
Active Contributor
0 Kudos

Hi Athar,

What version of Crystal Reports 2008 are you using?

Crystal Reports 2008 SP5 and higher now let's you show the prompt description instead of the prompt value on the report as Vitaly suggested.

In the Edit Parameter dialog box under "Value Options", you now have an option to either "Show Value" or "Show Description".

If you do not wish to upgrade, here's what you need to do:

Assuming the ID field is a number field, here's what you need to do:

1) Create a formula called 'ID' in the Main report with this code:

stringvar prompt;

numbervar i;

for i := 1 to ubound({?ID}) do

(

    prompt := prompt + totext({?ID}[i],0,"") +",";

);

left(prompt,len(prompt)-1);

2) Insert a Subreport on the Report Header. The Subreport should have the table that contains the ID and the Description field.

3) Right-click the Subreport > Change Subreport Links > Move the formula we created from the Panel on the Left to the 'Fields to link to' area (Panel on the right)

4) Uncheck "Select data in subreport based on field" option

5) Go into the Subreport and create a record selection formula like this:

stringvar array arr;

arr := split({?Pm-@ID},",");

totext({Description},0,"") IN arr;

where {Description} is the Database Field for Description

6) Place the Description field on the Details Section and suppress all the other sections.

Refresh the report and you'll see the Descriptions for the prompts you select one below the other on the Report Header.

If you wish to see a comma separated string, then go back to the Subreport and create a formula:

WhilePrintingRecords;

stringvar desc;

desc := desc + {Description} + ", ";

Place this formula on the Details Section and suppress the section.

Create another formula to display the string. Place this formula on the Report footer Section and this section needs to be un-suppressed:

WhilePrintingRecords;

stringvar desc;

left(desc,len(desc)-2);


Increase the width of the field and also right-click the field > format field > check "Can Grow" option.

That's it! Let me know how this goes!

- Abhilash

vitaly_izmaylov
Employee
Employee
0 Kudos

Ok,

Please help me understand what I am missing here.

See attached report (rename .txt to .rpt). I've created a quick sample with ID and Customer Name, added dynamic parameter ID and set Customer Name as a description

Dropped parameter to Report Header - it shows ID

then

Edit Parameter

Scroll down to the last settings of the parameter as shown on my screenshot in my previous post

"Show Value or Description" = Show Description

Now the report shows the Description in the Report Header

Is not that what you are trying to achieve or I misunderstood the problem?

JWiseman
Active Contributor
0 Kudos

hi Vitaly,

are you trying just to print the values of the parameter on the report? if so, create a new formula to place on your header with syntax similar to

join({?YourParameter}, ',')


cheers,

jamie

Former Member
0 Kudos

Hi,

Thanks for your great support like always... unfortunately i had CR 2008 SP1 installed.... but i am going to upgrade it to SP5 today....i think its going to be a easy thing that way but if i could not get the SP5 then i will definitely go for this solution.

Once again Thanks Abhilash Kumar

Former Member
0 Kudos

Hi Vitaly,

i am using CR 2008 SP1 and that's why i don't have the option you are talking about in my client tool...

i will upgrade to SP5 and then i will have that option.

Thanks for you help

Answers (1)

Answers (1)

jyothirmayee_s
Active Contributor
0 Kudos

Hi,

Go to the parameter and beside Value field>>select Description Field" of the ID and then say Action>> Import, the values.

Under the value options of the parameter select>> "Prompt wiht Description with Only">> set as "True".

You should now be able to see the description rather than just ID.

Thanks,

Jothi