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

drilldown zeroes shared variable...continued need for help on thread

Status
Not open for further replies.

pvirsf

Technical User
Aug 30, 2004
35
US
After duplicating my situation in one of the CR sample Xtreme reports, drill down works fine and the shared variable is not zeroed. The sample uses a MS Access data file. My report accesses a SQL Server db over a VPN connection. Could this be a factor?

All seems to work fine except for this issue. In the main report preview, I can print or use the Shared Variable just fine and it has a non-zero value depending on the field values processed in the subreport that sets it, with none of the sections in the main report hidden. If I hide the details section(not even the section with the formula using the Shared Variable), then upon drilling down to that detail, the Shared Variable value used in a formula in the Group footer immediately following that detail section, goes to a zero value. I know this because I test for it and flag it to avoid a divide by zero or null situation. Its got me stumped. Help please if anyone can. -R-

 
Try posting technical information:

Crystal version/edition
Database AND connectivity used
Example data
Expected output

To display a zero value for a shared variable, set it to zero in the group header first, such as:

GH1
whileprintingrecords;
shared numbervar MyNum := 0;

Subreport
whileprintingrecords;
shared numbervar MyNum := <some value>

GF1
whileprintingrecords;
shared numbervar MyNum

If the subreport DOESN'T have a link, it will result in zero.

Perhaps your check for divide by zero is the culprit as well.

You'd have to share the formulas used and specifically where they are for more precise assistance.

Hopefully this resolves.

-k
 
Thks for responding.
CR 9.2.2.693

RHa formula
WhilePrintingRecords;
Shared NumberVar Array E1ValuGT := [0, 0, 0, 0, 0];
1

RHb Subreport
RH formula
WhilePrintingRecords;
Shared NumberVar Array E1ValuGT;
Redim Preserve E1ValuGT [5];
1
Detail formula
WhilePrintingRecords;
Shared NumberVar Array E1ValuGT;
If( ({wsrpt_activity.ClassID} = 163134)
and ({wsrpt_activity.Status} = 1)
and ({wsrpt_sale.Contract_Status} = "Closed")
and (IsNull({wsrpt_sale.Total_Purchase_price})
Then (
E1ValuGT[2] := E1ValuGT[2] +{wsrpt_sale.Total_Purchase_price};
1
)
Else E1ValuGT[2]

G1Hdr Sales rep
G2Hdr Sales Type
Detail formula prints {wsrpt_sale.Total_Purchase_price}
and other data base fields are also printed
G2Ftr Running total with above condition for inclusion,
reset on Sales Type, plus
Formula for %
WhilePrintingRecords;
Shared NumberVar Array E1ValuGT;
Redim Preserve E1ValuGT [5]; // It needs this to work???
If( E1ValuGT[2] = 0)
Then 9999
Else {#RT_G22}/E1ValuGT[2]*100

G1Ftr Running total with above condition for inclusion,
reset on Sales Rep, plus
Formula for %
WhilePrintingRecords;
Shared NumberVar Array E1ValuGT;
Redim Preserve E1ValuGT [5]; // It needs this to work???
If( E1ValuGT[2] = 0)
Then 9999
Else {#RT_G22}/E1ValuGT[2]*100

As I said, when all sections in the main report are shown, everthing works fine and the percentages and RT's print correctly. If I hide the detail, the RT's and %'s still print correctly in group footers 1 and 2.

But, now when I drill down to view the detail, the percentages become 9999% as per the denominator or the Shared Variable E1ValuGT going to zero. This is not the desired result. I want to correct %'s printed on the group footers as before along with the drilled down detail.
Hope this helps you see where I am going wrong. -R-

 
One other thing, I am connected to a MS SQL Server data base over a VPN connection. The report utilizes a data source defined using ODBC on my machine to handle the login and connection to the MS SQL database.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top