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!

Summary on non-recurring field question 1

Status
Not open for further replies.

mjjks

Programmer
Jun 22, 2005
138
US

Hi All. I'm doing something wrong as I get this error: "A Summary has been specified on a non-recurring field. Details: @A_Count"

Formula @A_Count:
Code:
if {@A_Time} > 0 
[highlight]and {usp_RPT_RW_CONDS_TIME;1.TIRE_CHAIN_RSTRCT_DESC}<> Previous({usp_RPT_RW_CONDS_TIME;1.TIRE_CHAIN_RSTRCT_DESC})
and {usp_RPT_RW_CONDS_TIME;1.TIRE_CHAIN_RSTRCT_DESC}<> "<No Restriction>"[/highlight] then
    1
else
    0;

What I'm trying to do is to output 1 only if description changes (unique). I Sum this formula later to get count.

{@A_Time} formula simply converts time difference into minutes and have output as either minutes (234) or 0.

{usp_RPT_RW_CONDS_TIME;1.TIRE_CHAIN_RSTRCT_DESC} field is in hidden details section.

Data in {usp_RPT_RW_CONDS_TIME;1.TIRE_CHAIN_RSTRCT_DESC} is like this:
<No Restriction>
Condition A
Condition B
Condition C

It all worked, counting, until I added highlighted section in the code above.
Anyone can advise me on this?
Thanks. CR is ver. XI

 
You can't insert summaries on formulas containing the previous() or next() functions, as these evaluate across, not within, records. You either have to use a running total or set up the formula like this:

if {@A_Time} > 0 then
{usp_RPT_RW_CONDS_TIME;1.TIRE_CHAIN_RSTRCT_DESC} else
{@null}

...where {@null} is a new formula that is opened and saved with nothing entered. This assumes the desc field is a string. You can then insert a distinctcount on this.

-LB
 
Thanks for the reply LB.

I apologize if I confused you with a word "unique".
I don't really want to count unique/distinct values, but when they change. Let me try to explain again. So, I have {@A_Time} formula that will output 1 for "Condition A" and 0 for everything else. In {@A_Count} formula I need to count "Condition A" only when changes from 0 to 1.

Code:
Desc                 A_Time
-----------          ------
<No Restriction>       0
[highlight]
Condition A            1
Condition A            1
Condition A            1
[/highlight]
Condition C            0
Condition B            0
Condition A            1

In an example above "Condition A" would be counted only once in highlithed section. That's why I tried to use "previous" function. And with distinct count I'll get only 2 because it will count 0 & 1 as distinct items.

Thanks for your help.

 
Let me clarify. My suggestion would have not counted the zero as 1.

Try inserting a running total that does a sum of {@A_Time}, evaluate on change of {@A_time}, reset on change of group or never, depending upon your needs. You cannot, however, group on this.

-LB
 

LB, thank you so much for your help. It works. I actually used running total on {@A_Count} instead of {@A_Time} and reset it at group level.

Only problem I have is that it comes back with 0 when group detail rows have all 1's, and I need to count that condition as one. I'll try to think of something.
Thanks again.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top