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

Reset of a Shared String Var not happening 1

Status
Not open for further replies.

bobpv

Instructor
Sep 3, 2002
107
US
I am totaly lost here, and I just seem to be missing the solution. Hope someone out there has been through this!

Report needs a subreport to pull in ink information. This is a printer, and so there in a 1 to many relationship in ink colors that requires a subreport. So everything looks good, created the var. and tesed out fine, even did a bit of the needed formatting. So far so good. When I link to main report, the var will not reset! It keeps updating the information from the subreport, and I end up exceeding the 255 limit. I have tried moving the reset around, but to no avail. Here is my reset (I use basic syntax), maybe it is wrong? Is there a trick to resetting a string var?

SHARED INKS AS STRING
INKS = ""
FORMULA = INKS

Anybody see something, or have any ideas, I would be very appreciate of the assist!
 
I don't use Basic Syntax, but your post doesn't describe much about where the subreport is, if there are groups, where you're reseting it.

To reset a variable, do so before you run the subreport.

If the subreport is at a Printer Group Header, right click the Printer Group Header and select insert section below.

Move the subreport into Printer Group header B

Place the reset formula in Printer Group header A

In Crystal syntax the reset would be:

whileprintingrecords;
shared stringvar inks := "";

I've no idea why you have formula = inks in there...

-k
 
Yes, I have groups in the subreport, Group a is the job number, group 2 is the part number data. I am running the var. from the group footer 2, which would give me the string of info I seek. Reset is in group header 2, to reset the var before it runs the next part.

It works great for a single job, but it will not reset in the main report.

The main report is linked to the sub on both job and part numbers. The subreport is inserted in the main in a detail section above the main report detail, with the main reset in the group header there (group on job number) where, I might add, I also have 4 other shared NUMBER var which are working fine. It's only the string which will not reset.

The formula = inks is basic syntax. I have been using basic rather than crystal lately, as it is simpler to write, for me anyway. But as I said, I have created 4 other number var which are working flawlessly, using the exact same technique, I am wondering why the string is messed up?
 
I suppose it could be a bug, but it's generally an oversite when dealing with variables.

If a subreport is in the details, and the reset is at the group header level, then it makes sense that it isn't resetting if there are numerous details as it's only reset at the group level, not per subreport execution (detail).

Assuming that you're concatenating the string at the details with each return of the shared variable, and then displaying it at the group footer level, then your theory seems fine.

Try using a guide to demonstrate how you're using the shared variable:

gh1
gh2 <reset var>
det a <subreport>
det b <concat variable>
gf2 <disp var>
gf1

Also keep in mind that subreports are extremely inefficient, so a redesign of the joins might be in order.

-k
 
I found the little problem. You put me on the right path, the group was part of it. Thanks a bunch there Mr. S!

The main error was in my original setup, I had an extra grouping by side which threw it out, and as I had supressed the section, I forgot it was there. Working like a charm now!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top