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

Using a Running Total as a Parameter 1

Status
Not open for further replies.

piovesan

Technical User
Jan 23, 2002
159
CA
Hi. My report lists a bunch of applications and each application should have one, or many, decisions. The user wants to be able to list the applications that do NOT have any decisions. What I was thinking of doing, was creating a running total of the decisions (therefore I get the ones that have "0") and then create a parameter where the user can query where those are 0. But I can't seem to get a parameter to run off a running total field? Is this something I "can" do, or is there a better way??
Thanks for the advice!
 
How is a decision represented in the database? Is there a field called decision? Is it null when there are no decisions? Or does it contain some other value if there is no decision? Maybe show a mockup of some data that shows some different scenarios.

If the field is null when there is no decision, then you could create a formula like this:

//{@nulldecision}:
If isnull({table.decision}} then 0 else 1

Insert a group on {table.applicationID}. Then you could go to report->selection formulas->GROUP and enter:

Sum({@nulldecision}, {table.applicationID)=0

This would display only those apps with no decision.

-LB
 
That's great lbass and it works, but how can I make that a parameter? The user wants to be able to select a parameter to sometimes look at only those without the decision, and sometimes wants to look at those With the decision... and sometimes all of them.
 
Oh I think I got it. I removed the Sum({@nulldecision}, {table.applicationID)=0 from the group selection and built a parameter called Decisions.
Then in the record selection I put:
(if {?Decisions} = "No Decision" then {@nulldecision} = 0
else if {?Decisions} = "Has Decision" then {@nulldecision} = 1
else if {?Decisions} = "ALL" then ({@nulldecision}= 0 or {@nulldecision}= 1))

This works.
Thanks so much lbass!!
 
If it is possible for an application to have both a null decision and a non-null decision, your solution will not work, since any application that includes st least one null decision will be returned when you select “No Decision”. That’s why I asked for sample data. Based on your formula, it appears that an application can have nulls AND data in the field. So my first solution still applies, but with the addition of a parameter, the group selection formula would look like this:

(
{?Decision}=“No Decision” and
Sum({@nulldecision},{table.application})=0
) or
(
{?Decision}=“Has Decision” and
Sum({@nulldecision},{table.application})<>0
) or
{?Decision}=“All”

Apologies for neglecting to add in the parameter earlier. Be sure to replace the quotes in my post with your own, as the quotes from my iPad will throw an error.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top