Displaying a parameter's description value

15,682

Solution 1

I agree with Ryan--there isn't a native mechanism to grab these values. A user-function library (UFL) might be an approach worth investigating.

In lieu of that, I handle this a number of ways:

  1. a formula with a case statement to convert the value to a description.
  2. a custom function that does the same a #1; custom functions can be shared w/ other reports via the BOE repository
  3. use a subreport to query a table that can covert the value to a description. store the values in an array in the Detail section (suppressed), then Join() the array in the report footer. if you embed the subreport in its own section, it will expand as needed to accommodate an expansive list
  4. you might be able to adapt #3 to use a list of values exposed by BO's query as a web service (QAAWS), but I haven't experimented with this. If it doesn't have an associated schema document, CR won't be able to use the XML webservice as a data source.

Solution 2

First, Concatenate the parameter value and the description together and delimit the two values using a pipe '|' or other lesser used character

Example: CustomerID, CustomerName -> 12345|ABC Company

Second Use a Crystal function with an array to display the description side on your report i.e everything after your delimiting character

Numbervar i;
Numbervar j;
StringVar Array z := "";

Local StringVar Array x := split(Join({?My Parameter},";"),";");

j := count(x);

redim preserve z[j];

for i := 1 to j do(
z[i] := right(x[i],Length(x[i])-instr(x[i],"|")) 
);

join(z,",")

Third. Create a second function like the one above to return the Parameter value to the left of the delimiter to use as part of the report's Selection Formula**

Share:
15,682
contactmatt
Author by

contactmatt

Updated on June 27, 2022

Comments

  • contactmatt
    contactmatt almost 2 years

    In Crystal Reports v 11, is it possible to display the 'Parameter Description' value on the report, as opposed to only the parameter value? Whenever I drag the parameter onto the report to display it, only the value is displayed, and I want to print the description.

    Note: I'm working in Crystal 11 (XI), not the .NET Crystal Report plug-in.

  • contactmatt
    contactmatt over 12 years
    Thanks a lot for the #3 idea. The parameter is dynamic, so what I was able to do was take the parameter value and pass it to a "mini" subreport that simply queried the database for the description field off of the parameter value. Luckily the parameter value is unique.