By using this website, you agree to our Terms of Use (click here)
I have a shared variable(e.g., $order total) which passes from a subreport group subtotal linked to the corresponding field (order number) in the main report. Some of the orders in the main report do not have a corresponding value in the subreport. If an order doesn't exist in the subreport, the previous existing $order total from the sub report incorrectly gets used in that order's calcs until the next subreport order number comes up. I've tried to vary the location of the passed variable in the main report. What is the syntax to reset the variable to zero after each order number but still grab the calc from the next order in the subreport?
Hmmm, I've seen this before, but am trying to remember the specifics of it.
Would you be able to attach the main report and the subreport so I can take a look at them?
I think you need to edit the variable and give it a "resetgroup" property. That tells the variable to reset itself after a specific event. It fixes issues on my end, as I have to call a subreport to do a time-phased inventory run and I needed to reset my weekly quantities. Here's a shot of what that screen looks like, please note that my group is named InventoryItem, it's not a class name, just a group name:
In your case, the drop down lists "Account" and I think it'll fix your issues:
My process order is set to "always" on my variable, yours is set to "while read". Might be worth trying a quick toggle on that one, just to see if it sticks. Otherwise, I'll defer to Tim on this one as he has much more experience.
Got it!
If you use the Function>Program Shortcuts>
Assign('$subReport1_Variable',0) at the group start it works
Thanks so much for chiming in on this Michael. I'm not sure I have much more experience on these variables because I try to avoid them as much as possible. So I totally appreciate your input.
Julian, just to clarify. Were you able to get it working by including that Assign formula in a variable at the start of the group in the main report? Like maybe replacing what you had in your Reset variable like this:
I wonder if something along the lines of Michael's suggestion would have worked. Something like this in the variables at the start of the group in the main report:
Yes Tim, the Assign was applied in a variable in the Group Header in the Main Report.
When I have a chance I'll try the other suggestion as well and feed back
Cool. Hey, as long as it's working, that's good enough for me. I was just curious 🙂
Well I've never used the assign function before. That's an awfully slick way to override a variable. I'll be keeping that one in my toolbox. Thanks for sharing Julian!
Hi Ahmed,
Have you tried placing the variable below the Subreport in the Main report to see if that makes a difference? Can you attach the .rpx file for both reports (the Main report and the Subreport)?
Hi everyone, I don't really understand about passing variable from sub report. So i wanna try it and i edit reports from Julian, adding a variable in to Sub report but the result is always zero. I mean i make string variable and the value is "For Test" but why the result is zero, Can anyone help?.
Thank You
Hi @iskandar,
I believe the variable in the Subreport only gets set if there are records. In your screenshot, the Transfers subreport section is empty for every GL Account. Can you find a page that actually has some records in the Transfers section? Then we'll know for sure whether the variable is actually getting set in the Subreport.
Are you sure that any records are printing in the Subreport? It doesn't look like it from the last screenshot. Since you put the variable in the detailSection1 of the Subreport, it will only calculate if the Subreport pulls data. It doesn't look like any data rows from the Subreport are printing in your screenshot.
I just posted an example of calling a Subreport variable from a Main report here:
https://www.augforums.com/augforums/acumatica-report-designer/reset-group-on-a-sub-report/#post-3548
Hi guys,
I'm having an issue with passing a subreport variable to the main report as well. Hoping someone can spot out what I'm doing wrong. I have 2 subreports in the standard sales order report footer. One for total payment to account for multiple payments scenario. And the other one to break out discounts from regular discounts and a specific negative discount for credit card processing fee. The $PMT_TOTALPMT is working just fine but I don't know why the $DISC_CCFEE doesn't work. Both subreports print ok as subreports but $DISC_CCFEE won't work in a subreport variable. It keeps producing zero value. I have tweaked it so many different ways but still can't get to work for CCFEE.
The Master report has both Subs set to FALSE for visible. That should be set to TRUE, although you do have it visible for Excel, so it'd show if you export to Excel, but not in the web-browser.
But you said you're seeing a 0... Would you mind posting your other sub-report? It's been a bit since I've hit sub-report variables and they're a bit finnicky, it'd be nice to compare your files. Other than the FALSE visibility flag, this looks reasonable to me, assuming you are indeed checking a file with the discount code CCFEE.
Wish I had more help to give you... Once you post your second sub, I'll review this again unless Tim/Shawn beat me to it.