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

Formula Based on Parameter

Status
Not open for further replies.

jenschmidt

Programmer
Sep 30, 2002
145
US
I have a very flexible set of reports that allow end-users to change the fields the data is grouped on and to narrow down the data set without going into the report to make modifications. Most of the flexibility is built with parameter fields. But, because the reports are so flexible, I need a label at the bottom of the report that shows how they've narrowed down their data set.

The default value for all the parameters is "all" so that if they ignore it, all the data is pulled. I do not want the "all" default reflected in the label, just the fields where they have picked specific data.

It seems that I get an error on every statement I try to put together. Any ideas?
 
I create multiple formulas and drop them all into a text box for this sort of concern.

Here's an example of one formula:

// Demonstrates the choices made for the Classification parameter
WhilePrintingRecords;
Local Stringvar Array InputValue := {?Classification};
Local StringVar lbl := "Classification: ";
Local StringVar str := "";
if InputValue[1] <> 'All' then
str := lbl + Join(InputValue, &quot;,&quot;) + chr(13);
str

-k kai@informeddatadecisions.com
 
Thanks for the help! When I insert my parameter field where your ?Classification field is, I get an error that says &quot;string array required&quot;. I tried a different field and the error was &quot;error in parse tree&quot;. In both cases, the field I used was a string value.

Arrgghh!
 
Change your parameter field to multiple values, or change my code to:

// Demonstrates the choices made for the Classification parameter
if {?Classification} <> 'All' then
&quot;Classification: &quot;+{?Classification}
else
&quot;&quot;
kai@informeddatadecisions.com
 
I hate to keep bugging you - thank you so much for the help!! I have all the parameters set to multiple values (I double checked just to be sure). I used your second formula and I received the same &quot;string array required&quot; after the &quot;else&quot; part of the formula.
 
I didn't have an else part for the mulitple values, if you have multiple values, use:

// Demonstrates the choices made for the Classification parameter
WhilePrintingRecords;
Local Stringvar Array InputValue := {?Classification};
Local StringVar lbl := &quot;Classification: &quot;;
Local StringVar str := &quot;&quot;;
if InputValue[1] <> 'All' then
str := lbl + Join(InputValue, &quot;,&quot;) + chr(13);
str

Otherwise use (I had a typo in this before, it had a + wher it should have had a =:

// Demonstrates the choices made for the Classification parameter
if {?Classification} <> 'All' then
&quot;Classification: &quot;={?Classification}
else
&quot;&quot;
kai@informeddatadecisions.com
 
Sorry, kinda tired, 26 days of working every day...:

Otherwise use (I did NOT have a typo in this before):

// Demonstrates the choices made for the Classification parameter
if {?Classification} <> 'All' then
&quot;Classification: &quot;+{?Classification}
else
&quot;&quot;
kai@informeddatadecisions.com
 
Thank you so much for all your help! It seems I keep getting errors no matter what I do ... frustration is mounting! :) On the first suggested formula of your last response, it gives me the &quot;error in parse tree&quot; error - I don't know what that means. On the second, it tells me I need a boolean after the &quot;else&quot;. Anyway, don't feel like you have to respond any further - you've been so much help already!! If you have another idea and have time feel free to share - but please don't feel obligated!

Thanks again!
Jen
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top