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

calculations based on a shared var from subreport.

Status
Not open for further replies.
Mar 31, 2004
113
US
our order system and our credit control system are on 2 databases. i'm trying to give sales a list of outstanding orders approv and not approv by CC. i can bring the approv field through via a subreport in the details (or group header) and i have calculations in the details b section to say if CC aprove = 'Y' then order.val else 0 (and vice versa for not auth) but it errors saying:

'a summary has been specified on a non-recurring field'

any ideas?
 
Show your formulas and where in their respective reports they are.

The error is stating that youare attempting touse a Crystal aggregate function against a value that isn't returned foreach row, such as trying to sum a value created in a groupfooter.

So you may have to create a manual formula to do the aggregate.

-k
 
the string i'm bringing through from the subreport returns and number of values which i use a formula to get into three groups:
if {@status} = 'Credit Release' then 't' else
if {@status} = 'Frozen (in CS3)' then 'f' else
'Error'

every record will now have a status, so in the same section i say if status = t then order.value and then sum that to give me the approved order values (same for f)
 
Not sure why you dislike stating particulars, it can't be any clearer than pleasepost your formulas and where they and thesubreport are.

Obviouslywhat you are posting is only part ofa formula,and we don't know where it originates, or where it's used.

-k
 
the formula i posted is the one that brings the stringvar from the subreport. the subreport sits in details a
this formula sits in details b and in the group footer i have the formula which says:

if ({OPHEADM.STATUS} < '7' and ({OPHEADM.DATE_REQUIRED} in ({?Start Date} + 1) to ({?Start Date} + 7))) and {@Authorised} = 't' then

{@Value} else

0

which i hoped would give me the order value for a certian date range for auth orders
 
Well that formula doesn't reference a shared variabble, so it can't work.

You must declare shared variables in each formula:

Referncing @authorised without describing what is in it willlead to questions, not answers.

Please, slow down and explain what you have and what you want, we areblind to your formulasand wherethey are.

Here's basic shared variable theory:

In the Details A ofmymain report Ihave a subreport (horrible idea to use asubreport in the details, must be slow...) has a formula such as:

whileprintingrecords;
shared stringvar MyVar := {table.field}

Then I reference the variable in the Details B of my main report using a formula:

whileprintingrecords;
shared stringvar MyVar;
"My subreport says " & MyVar

Hopefully this gives you some theory toget beyondyour problem, otherwise, please show your formulas in their entirety and where they are.

-k
 
sorry guess i'm not explaining myself very well. originally everything was in one database so the report was very simple. it broke down by salesman how much auth and un-auth sales he had yet to be delivered out the door.

we now have a new system on a different database for the authorisation part which i have to put in a subreport and link via order number. for each order there maybe multiple lines each having a value so although putting a subreport in details is slow but i'm not sure how much choice i have. so basically i pass the auth code back through for each line then try and use it to decide if its auth or not.

the shared var i use is in @status where depending on what i bring up i then give it a 't', 'f' or error. i then reference this @status field when trying to sum this up.


hope this makes more sense......thanks.
 
You must show the contents of ALL nested formulas for anyone to be able to troubleshoot this issue. Also, you have not shown any formula using a summary, so where does the summary fit into this?

-LB
 
sorry i've not worked this weekend. the only formula's are

shared string var in the subreport (in details a) to bring the 't' or 'f' through to the main report which i display (in @status) by stating the string var (this comes through on details b fine)

then i use the formula i said saying if status = 't' then val else 0 (and another one for the converse) again in detail b

then i try to sum these formula's at group level. thats when the error message comes up.

cheers
 
if you want the answer to this problem then PLEASE SHOW ALL OF YOUR FORMULAS - IN DETAIL

The answer is fairly easy as you will just need to accumulate the values returned from your subreport in a formula. But without seeing all of your formulas we can't give a precise solution.



Gary Parker
MIS Data Analyst
Manchester, England
 
there are no other fomulas other than the ones stated.

subreport:
shared numbervar status:= {ORDER_.STATUS};(held in details a)

details b formula @status:

shared stringvar status; (which displays the status fine)

in the same section the formula is:

if ({OPHEADM.STATUS} < '7' and ({OPHEADM.DATE_REQUIRED} in ({?Start Date} + 1) to ({?Start Date} + 7))) and {@status} = 't' then

{@Value} else

0

then this formula is sumed at group level.


{@value} is just the field value unless the order starts CN then its -field.
 
Why do you have different variable types declared for the Shared Varible Status ? In the subreport this is declared as number yet in the main report this is declared as a string

any way change the @status formula in the main report to accumulate your values

i.e.
Code:
//@Status
WhilePrintingRecords;
Shared StringVar Status;
Global NumberVar AccumValue;

if ({OPHEADM.STATUS} < '7' and ({OPHEADM.DATE_REQUIRED} in ({?Start Date} + 1) to ({?Start Date} + 7))) and {@status} = 't' then
AccumValue := AccumValue + {@Value};

Then create a new formula to display the accumulated value in your group footer

Code:
//@Display
WhilePrintingRecords;
Global NumberVar AccumValue;

Lastly you will need a formula to reset the value of the variable for each group, place this in your group header section

Code:
//@Display
WhilePrintingRecords;
Global NumberVar AccumValue := 0;


Gary Parker
MIS Data Analyst
Manchester, England
 
Slight mistake on my last post, The status formula should be

Code:
//@Status
WhilePrintingRecords;
Shared StringVar Status;
Global NumberVar AccumValue;

if ({OPHEADM.STATUS} < '7' and ({OPHEADM.DATE_REQUIRED} in ({?Start Date} + 1) to ({?Start Date} + 7))) and Status = 't' then
AccumValue := AccumValue + {@Value};

a formula can not refer to itself.

HTH




Gary Parker
MIS Data Analyst
Manchester, England
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top