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

CR9 shared variable and summary 1

Status
Not open for further replies.

darthwing

Programmer
Joined
Jun 28, 2005
Messages
8
Location
FR
Hi,

here's my big problem that i cannot manage to solve myself :

I m listing some bills and i want to get for each bills the count of bills that are related to the same person.
after that i want to do a mathemathic operation with the amount of the bill and the value that i get with the count.

For that, i m using a main report for the list of the bills and subreport for each bill that return the count.

when i print each bill with each count related there's no problem, i've got the corrected values displayed.

But everytime i try to do mathematic operation CR9 return this message :
a summary was specified on fields not periodical


here is my structure

Report header
page header
group header 1
group header 2
details a
details b
details c
group footer 2
group footer 1

page footer of report a
page footer of report b
page footer of report c
page footer




details a contains subreport
details b contains the print of the shared variable
details c contains each row of the list

the mathematic operation must be donne on details c

thx for your great help


 
Please share the both the shared variable formula you are using in the subreport and the formula you are trying to use in detail_c.

-LB
 
in subreport :

(@nbfac):
Count ({CRX_FACTURE.FACTUREID}, {CRX_FACTURE.PROJETID})

(@nombrefacproj):
whileprintingrecords;
shared numbervar nombrefac;
nombrefac:={@nbfac}


in main report:

(@initMySharedVar) in report header
whileprintingrecords;
shared numbervar nombrefac:=0;

(@MySharedVar) in details b
whileprintingrecords;
shared numbervar nombrefac;
nombrefac

(@myFormulaForEachRow)
if ({CRX_PROJET.APPORTEURID} = 9999) or ({CRX_APPORTEUR.NATUREAPPORTEURID} = 9 and {CRX_PROJET.APPORTEURID} <> 806) or ({CRX_PROJET.NUMDOSSIER}<>0 and {CRX_PROJET.APPORTEURID}=0) then
if ({CRX_APPORTEUR.APPORTEURFORFAIT}>0) then
{CRX_APPORTEUR.APPORTEURFORFAIT}/{@MySharedVar)
else
if ({CRX_FACTURE.FACTURETYPE}='B') and ({CRX_APPORTEUR.APPORTEURPERCENTBANK}>0) then
{CRX_FACTURE.FACTUREMONTANT}*({CRX_APPORTEUR.APPORTEURPERCENTBANK}/100)
else if ({CRX_FACTURE.FACTURETYPE}='H') and ({CRX_APPORTEUR.APPORTEURPERCENTFEE}>0) then
{CRX_FACTURE.FACTUREMONTANT}*({CRX_APPORTEUR.APPORTEURPERCENTFEE}/100)
else 0

else 0



For each row the correct value is displayed within the main report details but can't be use in any formula.

thx for ur help
 
Are you saying that the formula in details_c is not working? Or are you trying to summarize that and that is not working?

Also, can the shared variable be null?

-LB
 
every formula work fine separatly,
but it 's some kind of summarizing

i have this display correctly:

name1 amount1 MySharedVar taxes1
name2 amount2 MySharedVar taxes2

total:
AgencyName totalAmount totalTaxes

i dont care about totaling MySharedVar but as i want to do taxes1 - {CRX_APPORTEUR.APPORTEURFORFAIT}/{@MySharedVar)
and
taxes2 - {CRX_APPORTEUR.APPORTEURFORFAIT}/{@MySharedVar)

it seems like some kind of sumarizing too.

 
I'm not following you. Are you saying your formula {@myFormulaforEachRow} is NOT working? What are taxes1 and taxes2? Are they two instances of one field/formula? If it is a formula, please share. Please use your field names consistently. There is probably a simple solution, but first the problem must be clear.

Also, please answer whether the shared variable can be null.

-LB
 
sorry for the misunderstanding;

i ll try to be as clear as possible.

yes the formula don't work everytime i use {@MySharedVar} in it. i got this error message :
"a summary was specified on fields not periodical(non-recursive)"

It s not possible that the value can be null. it at least 1
because it get from the subreport the count of bills that are related to this person,and it always >=1.

taxes is a value from my database displayed for each row
taxes1 for row1
taxes2 for row2

{@MyFormulaForEachRow} calculate for each row a amount depending on {@MySharedVar} value.

the amount returned is substract to the amount of each taxes



 
here an example :

owner_name bill_amount numberofbill taxes

john 1000 2 100
john 3000 2 900
alice 1500 1 300


john has 2 bill so i want that taxes become 100-70/2=65
and 900 -70/2 =865 for the second one

alice has one bill so i want taxes become 300 - 70 = 230

so the display will be :

owner_name bill_amount numberofbill taxes

john 1000 2 65
john 3000 2 865
alice 1500 1 230

 
I can't recreate your problem. To troubleshoot this, try inserting another detail section and drag it so that it becomes detail_a. Then place your initializing formula in it:

whileprintingrecords;
shared numbervar nombrefac:=0;

I'm wondering whether you do, in fact, have nulls, and if so, this would cause a division by zero error, I think.

-LB
 
i insert a new section below section a that become section b

i place the initializing formula in it.

it always says the same :

a summary was specified on fields not periodical(non-recursive)
 
The initializing formula belongs in detail_a, with the subreport in detail_b. Is that what you did?

I tried to recreate your problem and cannot.
I wonder if one of the fields in your formula is null. My only other suggestion is to lay out your fields in a detail section and then try some record selection formulas that will detect the nulls, field by field.

I would also check to see if you have some inserted summaries in a group footer that are inserted on a formula where you later added {@Mysharedvar}. An inserted summary wouldn't be available if you already had {@Mysharedvar} in a formula, but if you inserted {@mysharedvar} into the formula after inserting a summary, it could cause a problem.

Sorry I can't come up with anything else. Maybe someone else will jump in.

-LB
 
---The initializing formula belongs in detail_a, with the ----subreport in detail_b. Is that what you did?

yes it s what i did

And I have summary on formula in each footer,
summary on bill_amount and summary on taxes

the formula in which i want to insert the {@mysharedvar}
is part of a formula that is summarized in the footer.

i dont think there s null value becoz i always test if the value >0 before making a operation on it, if the condition is not accept i return 0 everytime.

thx for your interest in my problem
 
Try removing the inserted summaries in the footer that are based on formulas containing {@mysharedvar} and see if the error message goes away. You can always use a variable instead to get those summaries.

-LB
 
hello,

thanx for your great help, i finally manage to do what i want.

first of all, as u said, i remove all summaries related to formulas that use {@mysharedvar}

After that, i create lot of formulas in order to do a running total manually.

I think there was a null or 0 value somewhere but dunno how it comes as my count of bill must always be >0.

I ve bring up a formula that test if {mysharedvar} is >0 or no
in case it is >0 i return the value else i return 0
and everytime i do that the reporter stop and said there is error.

so instead of returning 0 when not >0 i decided to return 1 and everything goes well.

thanks again!!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top