Avatar of QTony
QTony
 asked on

Crystal XI: Filter a user parameter basedon a condition?

I have a subreport that is occasionally  needed; about once a week. When it is not needed, it is suppressed by a condition and does not display.

I would like to add a simple number parameter to this subreport that will allow the user to increase the final quantity that this report produces. (This report generates a list of wood panels)

I was able to create and install the parameter and it does work correctly. However, the parameter prompts for values   everytime the main report runs regardless of whether or not the subreport is supressed..

No matter what conditions I put prior to the parameter formula, I cannot get it to filter out when it is not needed. I know my filters are correct, because if I test them on any other formulas, they work fine. It is only on the parameter formula that they don't apply. I'm assuming I'm doing something incorrect and not understanding  how the parameter field processes.

Here is my parameter and the conditions I am trying to use with it:

If {@PL_GR_CLU_CALC 2} = 0 Then

"QTY: " & ToText({@PL_GR_0.25_CNC_CALC 2} ,0) Else

"QTY: " & ToText({@PL_GR_0.25_CNC_CALC 2} + {?My Parameter},0)

The above formula will still process ?MyParameter even if the the value is "0"



Thank you for looking
Crystal Reports

Avatar of undefined
Last Comment
QTony

8/22/2022 - Mon
vasto

The parameter prompt is shown before the report to start any calculation. It doesn't matter if the subreport os supressed.
QTony

ASKER
That being the case, do you know if it is possible to do some kind of record = null check via sql or some other method? You don't need to explain how, I'm just curious if it is something that is possible and within the scope of a basic user such as myself.

Thanks
vasto

What is the logic behind this parameter? Is it dependent from another parameter ?
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23
QTony

ASKER
Thank you for replying

No, it is not dependent from another parameter; per my original question above, it is only to allow the user to increment up a value. What the report does is total up wood panels that are generated by a cabinet making program All the totals are accurate, but when a total is a certain size,  the operator will often want to add a couple of additional panels to the total for errors, wastage etc.

The problem is that there are a total of 32 different panel types---many of which run infrequently---so if each panel type had a parameter to allow adjustment of the total, the user would end up with 32 parameters on a screen each time the program ran.

Typically, only 2-4 panels display during any given run so if it were possible, I would prefer that only those parameters that apply during the current run display.
Mike McCracken

What version of Crystal?

You could default all the parameters to 0 and the user would have to provide values for only those needed fo the given run.

You can easily control the prompts by writing your own parameter screen as part of a viewing application.

mlmcc
Ido Millet

One of the 3rd-party Crystal Reports UFLs (User Functiobn Library) listed at http://kenhamady.com/bookmarks.html adds an InputBox() function to Crystal.  
This allows your subreport to create a formula that checks for a value and then prompts the user for some input only if a condition is met.  You can also create such a UFL yourself.
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
vasto

I can see 2 possible ways to handle this:
 1.  Create a UFL library which will receive all calculated totals and show a dialog box to change them.

Here are 2 links how to this:
http://www.slxdeveloper.com/page.aspx?action=viewarticle&articleid=103
http://msdn.microsoft.com/en-us/library/ms227603(v=vs.90).aspx
 
 2. Implement a logic which will increment the number of panels inside the report. For example if the number of panels is between 0 and 10 add 0, if it is between 11 and 15 add 1 panel  .... You may add a parameter in the main report which will set the template so for the case 10-15 panels you will add 1 additional panel if the user selects template 1 or  add 3 additional panels if the user selects template 2. You can print both values: calculated and additional, which will help you to adjust the logic.

I would prefer the second method because once the logic is set this will be a normal report - you will be able to run it from any application , schedule it etc.
UFL will show a dialog box during the report rendering which will stop the process and will require additional user interaction ( scheduling will be not possible). If the report is running in a background thread this will crash the system because the message box will mess with the UI thread. If you are showing a question for each total this might be a problem too in case the increment for total 1 is somehow related to total 3.
QTony

ASKER
Thank you fall or the tips

Regarding my version, I am currently using Crystal XI...

Learning to create UFLs sounds really attractive to me but I think that for now, I will go ahead and take mlmcc's advice and create a targeted parameter screen with defaults set to 0. One question to mlmcc: When you say, "write your own parameter screen" are you referring to the default screen that is launched by Crystal when creating a ?Parameter field or or you referring to a separate mechanism to create a customised screen that differes in appearance from the default Crystal screen.

Thanks again
ASKER CERTIFIED SOLUTION
Mike McCracken

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
QTony

ASKER
Thank you, much appreciated...
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck