Link to home
Start Free TrialLog in
Avatar of patsylipp
patsylipp

asked on

There must be a group that matches this field?

I am trying to add a formula field into my report but when I try to verify it I keep getting an error "There must be a group that matches this field."    The situation is that I am converting an existing report to connect into an oracle database.   The original code for the field, pulling the data from a stored procedure is as follows:  

if {USP_RPT_STOCKLINES_AGING.QTY_USED} = 0 then
    formula = Sum ({USP_RPT_STOCKLINES_AGING.QTY_OH}, {USP_RPT_STOCKLINES_AGING.PN})
elseif Sum ({USP_RPT_STOCKLINES_AGING.QTY_OH}, {USP_RPT_STOCKLINES_AGING.PN}) >= {USP_RPT_STOCKLINES_AGING.QTY_USED} then
    formula = Sum ({USP_RPT_STOCKLINES_AGING.QTY_OH}, {USP_RPT_STOCKLINES_AGING.PN}) - {USP_RPT_STOCKLINES_AGING.QTY_USED}
else
    formula = 0
end if


What I produced is below.  I was getting various other errors which were fixed by changing certain keywords and stuff like that.  But with the code below I keep getting the error I mentioned.  


if {command.QTY_USED} = 0 then
 Sum ({command.QTY_OH}, {command.PNm_auto_key})
else if Sum ({command.QTY_OH}, {command.PNm_auto_key}) >= {command.QTY_USED} then
    Sum ({command.QTY_OH}, {command.PNm_auto_key}) - {command.QTY_USED}
else
     0


Any help?  
Avatar of Mike McCracken
Mike McCracken

Does the report have a group on this field, {command.PNm_auto_key}?

mlmcc
Avatar of patsylipp

ASKER

No, there is one grouping and it is done on another field that is selected from within COMMAND.   The problem is that that grouping is too broad for what I am trying to do.  The pnm_auto_key links me to quantity details for one record.  The field I am grouping by has many many records that would be associated with it.

ASKER CERTIFIED SOLUTION
Avatar of Mike McCracken
Mike McCracken

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Ok, that did it!   I didnt realize that the group had to be added into the report.  Added in the group, suppressed it, hid it, and then was able to do the formula the way I wanted to.   Thanks!