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

Parameter values display'd as the descriptions

Status
Not open for further replies.

knorth1233

IS-IT--Management
Sep 23, 2002
3
CA
I am trying to create a formula that will list out the multiple parameter choices that were made when the report is launched. My parameter choices are a series of numberical values that have coresponding descriptions. I would like to display a simple array of those descriptions in the report header. I just need some basic help with the array formula and how to return the corresponding "text" description.

eg Parameter 325 - description On Order
Parameter 326 - description In Stock

 
There might be a better way of building in the description codes, but this at least works. Create a formula {@parmdisplay}:

Local NumberVar i := 1;
Local NumberVar loops := UBound({?yourparm});
Local StringVar Display := "Selected: ";

For i := 1 to loops do
(
Display := Display & totext({?yourparm}[ignore][/ignore],0,"") &" - " &
(if {?yourparm}[ignore][/ignore] = 325 then "On Order"
else if {?yourparm}[ignore][/ignore] = 326 then "In Stock") &
iif(i<loops, &quot;, &quot;,iif(i=loops-1, &quot; and &quot;, &quot;.&quot;))
);
Display;

-LB
 
lbass -

iif(i<loops, &quot;, &quot;,iif(i=loops-1, &quot; and &quot;, &quot;.&quot;))

The second &quot;iif&quot; will never execute the true portion of this &quot;iif&quot; since &quot;i&quot; must be less than loops for that condition to fire and in order to get into that section from the first &quot;iif&quot;, i = loops.



Jim Broadbent
 
Jim--

You are right. I adapted this from someone else's post without thinking it through, and since I didn't get an error message (and didn't notice the &quot;and&quot; wasn't printing), I didn't realize there was a mistake. The &quot;iif&quot; clause should read:

iif(i<loops, &quot;, &quot;, &quot;.&quot;)

Thanks for picking up on that.

-LB
 
Sorry, the text descriptions aren't available in Crystal, which is a real nuisance...

You'll need a secondary resolver formula such as LB's.

I assume that you pass the values to the database for filtering, and then display for the user their choices.

A simpler formula might be:

Local NumberVar i := 1;
Local NumberVar loops := UBound({?stringtest});
Local StringVar array Display [loops];
For i := 1 to loops do
(
Display[loops] := totext({?stringtest},0,&quot;&quot;) &&quot; - &quot; &
(if {?stringtest} = 325 then &quot;On Order&quot;
else if {?stringtest} = 326 then &quot;In Stock&quot;);
);
&quot;Choices Made: &quot;+join(Display,&quot;,&quot;)

-k
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top