Skip to Content
Former Member
Oct 03, 2013 at 07:26 PM

Danger of using a shared variable from a detail level subreport?


Ok, here's the situation. I'm building a custom report for a PO based on a stock Syteline sp. One extra piece of information I need is a UDF at the PoLineItem (POLI) level that holds a conversion factor for qty and unit price calculations. I have a subreport that is retrieving the POLI notes from a SL stock view and passing them to the main report via a shared variable. I have placed the subreport in the Detail A band and it's properly suppressed so it executes fine but is hidden. My main detail band is Detail B. The notes are actually used in Details D. (Details C is vendor item info provided by the main sp). I have the subreport wired to the main report via a POLI row pointer provided in the stock sp result set.

In the sp for the subreport that gathers the notes, I'm also grabbing the UDF I need as well and again passing it along via a shared variable. Some concern has been expressed that this may not be a solid approach and could result in incorrect conversion factors being applied to PO lines because of the order the subreport and calculations are performed or rendered.

In other words, the conversion factor for line 1 may be applied to line 2 and therefore cause an order of 5,000 to slip out for a part that we typically order 50 of.

So I'm looking for some input as to a different solution, some way to assure that the correct data will always be provided for the line, say by forcing the execution of the subreport at a specific time, clearing the variable after each line, etc. or anything anyone else can throw at me.

I thought I could perhaps use one of the evaluation time functions but that doesn't appear to fit my situation either.

If I didn't explain myself well enough, please ask for a specific explanation about the confusing part and I'll do my best to give a better example \ answer.