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!

Parameter array in formula

Status
Not open for further replies.

cully651

Programmer
Aug 1, 2005
41
US
Hi everyone,

Let me first say thanks to all of you for your informative help! I'm a resident lurker and I find Tek-Tips to be a great resource.

Here's my question; I have a parameter that can take in multiple values, and I want to display those values on the report... so I wrote the following code which takes the array values and strings them together with comma delimiters.

local stringvar district;
local numbervar x := count({?district});
local numbervar i;

for i := 1 to x do
(district := district + {?district};
if i < x then
district := district + " , ";
i + 1;
);

district


The parameters in the report don't have any default values and the reports are accessed via Crystal Enterprise so only the values are passed from the front end to the report.

In some cases I'd much rather display the description of the values rather than the cryptic value. In other words, District 1 is represented by the value "1", but also has a name like "NorthWest District". In most cases it's ok just to show the value, but not always. Is there any way I can grab those descriptions from a table while processing the formula?

TIA!

 
You can either hard code the description into the above formula, changing the line to:

district := district + (
if {?district} = 1 then "District 1" else
if {?district} = 2 then "District 2" else //etc.
)
;

Or you could add a subreport into the report header that has the table with the value and description and then link it to the main report by linking the subreport value to the main report parameter. If you want them displayed in comma delimited fashion, then add a variable that accumulates the values in the subreport footer.

-LB
 
Thanks lbass. I was trying to avoid a command object or subreport for the sake of speed, but it looks like it's the best way to go!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top