Passing a variable from subreport to main report
Hello,
Was hoping to get some assistance on this issue I'm facing. I've got a sub-report that calculates a monthly goal based off the date selection criteria. And I'd like to pass this goal back to the main report.
In my sub-report, I created a new formula named ProcGoalVariable:
WhilePrintingRecords;
Shared Numbervar ProcedureGoal := cdbl({#ProcGoal})
While {#ProcGoal} is a running total I created for the sub-report and now I'd like to pass it back to the main report.
In the main report, I created a new formula named ProcGoalVariable:
Shared NumberVar ProcedureGoal;
ProcedureGoal;
But when I drop this into my report, it is returning a value of 0. In the screen shot, the Proc. Needed should actually equal the Proc Goal:
Any suggestions on how to pass this correctly?
Thanks for the advice,
I want to rewind a bit to make sure I am explaining myself clearly. My sub-report is pulling the correct numbers and it is located in GF#3 and contains two values that fall under "Proc Goal" and "Prod Goal". These are being calculated correctly and I would then like to pass them back to the main report for additional calculations done on this.
In the sub-report, a formula was created "ProcGoalVariable":
WhilePrintingRecords;
Shared Numbervar ProcedureGoal := cdbl({#ProcGoal})
In the main report, a formula was created "ProcGoalVariable"
Shared NumberVar ProcedureGoal;
ProcedureGoal:=ProcedureGoal;
Would having the same name inside the formulas being causing the issue? And I've tried inserting a new section below the section where my subreport lives and I still get a value of 0.
Not sure what else to try at this point.
Similar Messages
-
Passing Shared Variable from subreport to main report
Hello,
I am having difficulty passing the shared variable from the subreport to the main report. For some reason, when viewing the data, the value for the very first row is returning a 0 but the second row is returning the value that should be in the first row. Does anyone have an idea of what I'm taking about?
Thanks.
ZIn Subreport there is a group based on the client. There is a summarized amount field in this grouping. I placed a formula in the grouping and suppressed it. The suppressed formula is listed below.
{@ store client payments}
WhilePrintingRecords;
Shared CurrencyVar cRelatedPayments;
cRelatedPayments := cRelatedPayments+Sum ({amount.amt}.{client.client_number});
cRelatedPayments;
In the main report, there is 2 groupings, first grouping is the client and second is the invoice. The client grouping is displayed while the invoice grouping is suppressed.
The following is the formula in the main report to get the shared value.
WhilePrintingRecords;
Shared CurrencyVar cRelatedPayments;
cRelatedPayments;
This is placed in the client grouping.
I hope this helps.
Z -
Passing the values from subreport to master report in JasperReports
Hi All,
I want to pass the values from subreport to master report, but my subreport is without any query.
Please help me in this regard. its urgent.
Thanks & Regards
KrisHi,
Below link may help you
http://jasperreports.sourceforge.net/tips.tricks.html#returnvalues
regards
MJ -
Passing a variable from subreport to the main report
Hi guys, was unable to google this, so Im urning to you guys:
I was wondering whether it was possible to do this:
I have a subreport taking data from a table. In the main report, in the suppres condition of details section containing this subreport, I need to have a variable containing the total count of rows in that table. I know there are shared variables for that, but the problem is, that the variable in the condition is processed sooner than the one in the subreport.
Any ideas on this?
Thanks a lotTo Sharma:
Hi, unfortunately I can't. The subreport has its specific position in constallation with previous and following sections and must be right there.
To Raghavendra:
Hi, that was my first idea, but the problem is as I explained in my first message.
To both:
I have a table in subreport. This subreport is in main report positioned in details section "x". and I want to use that shared variable in the suppress condition of section "x". The problem is that the formula in suppress condition is processed sooner than the formula assigning a value to the shared numbervar inside the subreport.
and thats what im looking for - a workaround for that. btw im using CR 8.5
thanks again guys -
Crystal Reports 10, Want to pass values from subreports to main report
Post Author: playmkr278
CA Forum: General
Is there a way to just share values out of subreports.
The reason I ask is that I am having problems pulling the correct information in one subreport so I'd like to use 2 subreports to pull out Billable hours on one and Billed Hours on another and then add them together to display on the main report.Post Author: Jedit
CA Forum: General
Yep there is!
In your sub report
I the formula editor create a shared variable then create the same variable in your main report.
EG
IN your SUB
Create new formular called tothrs etcu2026..
whileprinting records;
shared numbervar tothrs: sum({table.fieldname}]
In Your Main Report
whileprinting records;
shared numbervar tothrs
this passes the value from your sub to the main, check help for different types of format as the one above is only for a number there are others for time & date etc..
hope this helps!
I have been doing a similar exercise myself but got stuck summing the parameter values in my main report, if you solve this let me know?
Please see http://technicalsupport.businessobjects.com/cs/forums/thread/6210.aspx -
Passing Array From Subreport to Main Report then Summing
Hi,
I am having troble passing an array from a sub report to the main repport. I have managed to create the array, pass it and display it in the main report, however the first value of the array is displayed twice. Here is the formulae I have used:
In the sub report:
whileprintingrecords;
shared stringvar str;
str:=str{@value}","
In the main report:
whileprintingrecords;
shared stringvar str;
stringvar array arr;
arr:=split(str,",");
join(arr,",")
Also, when I have managed to resolve the problem of the first value printing twice, I hope to change the array back to a number array and sum all of the values together. I'm not too sure how to do this either.
I hope you can help.
JulieUmmm... Isn't Join(Split(str,","), ",") = str? Why bother with the two extra lines of code? Also, are you sure the subreport isn't creating the "duplicate first value"? (I.e. The data has the same value on two records, so it's being added twice?)
Also if you're looking for the sum, why not create another shared variable and sum the value in the subreport as you're building the array (assuming you need the array for other purposes)?
HTH,
Carl -
Passing values from subreport to main report
Dear All,
I have used shared values in my sub report and i want to use that shared variable in my main report in one of the formulas for average calculation but i see the values as 0.
Can someone let me know what I am missing.
Regards,
SonaliHi
The most important thing to remember when using shared variables is that Crystal Reports must first evaluate the formula where the value is stored before evaluating the formula that retrieves the shared variable.
For example if you want to pass a grand total from the subreport to do a calculation in the main report, follow these steps:
1. In the subreport, create a formula similar to the one below:
//@SubFormula
//Stores the grand total of the
//{Orders.Order Amount} field
//in a currency variable called 'myTotal'
WhilePrintingRecords;
Shared CurrencyVar myTotal := Sum ({Orders.Order Amount})
2. Place this formula in your subreport.
3. In the main report, create a formula that declares the same variable name:
//@MainFormula
//Returns the value that was stored
//in the shared currency variable called
//myTotal in the subreport
WhilePrintingRecords;
Shared CurrencyVar myTotal;
myTotal
4. Place @MainFormula in a main report section that is beneath the section containing the subreport.
NOTE:
For the shared variable to return the correct value in the main report, you must place @MainFormula in a main report section that is beneath the section containing the subreport. This ensures Crystal Reports evaluates the @SubFormula before @MainFormula.
One way to do this is to insert a section below the section containing the subreport, and place @MainFormula in this new sub-section:
· On the 'Format' menu, click 'Section'.
· On the 'Sections' list, click the section containing the subreport.
· Click 'Insert' (at top of dialog box). This inserts an additional subsection.
· Click 'OK' to return to the report, and insert @MainFormula into this new sub-section.
The next time you preview the report, @MainFormula displays the value from the subreport. In this particular example, that value was the grand total of the {Orders.Order Amount} field.
5. Once you have verified that @MainFormula is returning the correct value from the subreport, you can include this formula in other main report formulas, such as:
//@NewFormula
//includes data from subreport
{@MainFormula} + Sum ({Customer.Last Year's Sales})
· Place this formula in the same section as @MainFormula, or in a section further down on the report.
You have now successfully shared data from a subreport with the main report.
NOTE:
This is not possible with On Demand Subreports in Crystal Reports since the report will not be processed until after clicking report.
Regards
Sourashree -
How to get shared date value from subreport to main report
Hi,
I need your help in passing the value of a running total that is located in the subreport to the main report. The running total in the subreport is getting the maximum of the Effective Date (which it is type in the database is date) for each group and it is value will change on the change of the sequence no. group. I am printing the value at the group footer which displayed correctly. Now my issue is that how to pass the value from the subreport to the main report as a date. I have created a formula that it is having the code:
shared datevar ddd := date(0,0,0);
ddd:={RTotl0}
The above formula is not compiled and it is first giving me an error at line 1 that date(0,0,0) is not accepted. Then when I removed it, it gave me an error that ddd:= can't have a running total to a datevar.
So can you please help in getting the value from the subreport and then to pass it to the main report as a formula as I need to include it in other formulas which it compares the dates.
ThanksHi Mohammed,
Are you displaying the shared variable on the Main Report's group footer as well?
Try changing the code to:
shared datevar ddd := cdate(0,0,0);
ddd:= date({RTotl0});
-Abhilash -
Passing a variable from a movie clip to the main timeline
Hi,
I'm having trouble passing a variable from a movie clip in my
flash file to the main timeline.
I have a movieclip with the instance name IntroNav which
contains several buttons. Clicking a button sets the variable
"page" to a specific name, i.e. page = "home"
However, outside of the movie clip, on the main timeline I am
unable to call this variable, and "page" seems to have no value.
Can anyone tell me why this is and how to solve it?
ThanksUmm, yes ... declare your variables correctly.
var page:String = new String(); //proper complete
var page:String; //strict typing
var page:String = "home"; //stirct typing with value
declaration
Do not declare the variable in your buttons, you would have
to do so in every button and be constantly resetting the value.
Declare it on the main timeline at the lowest level. You do not
need to use it as a _global, you just need to resolve your path
issues. You can 'set' the variable value from a button, without any
problem, but you have to call to the variable correctly.
You do not 'name' a variable as "_root.page" , the '_root'
refers to the lowest level of the SWF or the main timeline, as does
a call to ' _level0' (that's a zero). If the variable is declared
on the main timeline, and you're calling from the MC/button or
anywhere you can refer to the variable by calling to it by
the proper path of '_root.page'
To set the variable from any of your button/MC instances
call:
_root.page = "value"; OR _level0.page = "value";
But you must have the varibale declared on the main timeline,
and only once and the playhead should be stopped or it will reset
the value to the default upon looping. -
Slow performance refreshing report with multiple subreports in main report
I am using multiple subreports in my main report that appear to be slowing down the performance of the report considerably. Is there something I can do to increase performance with subreports.
Hi Brian,
Subreports are a known performance hog.
I would suggest going back to the drawing board and rethinking on the layout of the report. The best thing, of course, would be to completely get rid of the subreports by creating a single SQL statement that takes care of all the report's requirements.
Sometimes it is imperative to have subreports, in which case, you should try to make sure any selection filters from both the Main Report and the Subreport are passed back to the database.
Also, avoid using Page N of M for better performance - with or without Subreports.
-Abhilash -
Controlling execution of subreport on main Report in ssrs 2008 R2
Controlling execution of subreport on main Report in ssrs
Hi,
Am using more than 100 subreports in my main report using ssrs 2008 R2.
And given conditional Visibility in sub reports based on the Parameter selection in main Report . But the performance is very very slow in main report.
While selecting single sub report executes in seconds. The same report in main report executes in hours.
According to my view,
All the Sub reports executes and finally conditional visibility is working. Can we Control executing sub reports?
Regards, Gayathri devi P.S. : Please click the 'Mark as Answer' button if a post solves your problem! :)Hi,
I think the time to render 100 report sure will be long time and the main report want to render those reports.
So first why you do not separate those report on many reports for different purpose.
second if this is a dashboard report you may use many matrix in the same report and the parameters passed by default or based on expression.
I really hope if you make your report as dashboard report, many matrix many parameters render it once. As I remember I think SSRS will try to execute your
DataSets in parallel which will reduce your waiting time.
I hope this is helpful.
Elmozamil Elamir
MyBlog
Please Mark it as Answered if it answered your question
OR mark it as Helpful if it help you to solve your problem
Elmozamil Elamir Hamid
http://elmozamil.blogspot.com -
How to pass a variable from HTML to Flash
I have built my flash ad banner in Flash 9 and now want the
HTML code to pass the url over to the flash movie that it should
jump to when clicked.
The info in the help file seems out of date for the latest
HTML template as it uses mainly JavaScript to get round IE's
dreadful embeding issue. So my problem is, how do I pass a variable
from the HTML to the actionScript specified int he Help file
(running on a full screen button) as shown below?
myButton_btn.onRelease = function() {
if (clickTAG.substr(0, 5) == "http:") {
getURL(clickTAG);
via the html code now used by Flash 9 which is like this:
<!-- saved from url=(0013)about:internet -->
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1" />
<title>Advert_long</title>
<script language="javascript"> AC_FL_RunContent = 0;
</script>
<script language="javascript"> DetectFlashVer = 0;
</script>
<script src="AC_RunActiveContent.js"
language="javascript"></script>
<script language="JavaScript" type="text/javascript">
<!--
// Globals
// Major version of Flash required
var requiredMajorVersion = 9;
// Minor version of Flash required
var requiredMinorVersion = 0;
// Revision of Flash required
var requiredRevision = 115;
// -->
</script>
</head>
<body bgcolor="#ffffff">
<!--url's used in the movie-->
<!--text used in the movie-->
<!--
Coping
with
Growing
Audio
Series
Theraputic stories
for children aged
4 to 9
-->
<script language="JavaScript" type="text/javascript">
<!--
if (AC_FL_RunContent == 0 || DetectFlashVer == 0) {
alert("This page requires AC_RunActiveContent.js.");
} else {
var hasRightVersion = DetectFlashVer(requiredMajorVersion,
requiredMinorVersion, requiredRevision);
if(hasRightVersion) { // if we've detected an acceptable
version
// embed the flash movie
AC_FL_RunContent(
'codebase', '
http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,115,0',
'width', '120',
'height', '600',
'src', 'Advert_long',
'quality', 'high',
'pluginspage', '
http://www.macromedia.com/go/getflashplayer',
'align', 'middle',
'play', 'true',
'loop', 'true',
'scale', 'showall',
'wmode', 'window',
'devicefont', 'false',
'id', 'Advert_long',
'bgcolor', '#ffffff',
'name', 'Advert_long',
'menu', 'true',
'allowScriptAccess','sameDomain',
'allowFullScreen','false',
'movie', 'Advert_long',
'salign', ''
); //end AC code
} else { // flash is too old or we can't detect the plugin
var alternateContent = 'Alternate HTML content should be
placed here.'
+ 'This content requires the Adobe Flash Player.'
+ '<a href=http://www.macromedia.com/go/getflash/>Get
Flash</a>';
document.write(alternateContent); // insert non-flash content
// -->
</script>
<noscript>
// Provide alternate content for browsers that do not support
scripting
// or for those that have scripting disabled.
Alternate HTML content should be placed here. This content
requires the Adobe Flash Player.
<a href="
http://www.macromedia.com/go/getflash/">Get
Flash</a>
</noscript>
</body>
</html>You should use SWFObject to embed your Flash. Not only does
it make
embedding more straightforward, it makes passing query
parameters very easy.
Check out:
http://code.google.com/p/swfobject/
Dave -
www.offroadfire.com
Head Developer
http://www.blurredistinction.com
Adobe Community Expert
http://www.adobe.com/communities/experts/ -
How to pass a variable from HTML to Flash 9
I have built my flash ad banner in Flash 9 and now want the
HTML code to pass the url over to the flash movie that it should
jump to when clicked.
The info in the help file seems out of date for the latest
HTML template as it uses mainly JavaScript to get round IE's
dreadful embeding issue. So my problem is, how do I pass a variable
from the HTML to the actionScript specified int he Help file
(running on a full screen button) as shown below?
myButton_btn.onRelease = function() {
if (clickTAG.substr(0, 5) == "http:") {
getURL(clickTAG);
via the html code now used by Flash 9 which is like this:
<!-- saved from url=(0013)about:internet -->
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1" />
<title>Advert_long</title>
<script language="javascript"> AC_FL_RunContent = 0;
</script>
<script language="javascript"> DetectFlashVer = 0;
</script>
<script src="AC_RunActiveContent.js"
language="javascript"></script>
<script language="JavaScript" type="text/javascript">
<!--
// Globals
// Major version of Flash required
var requiredMajorVersion = 9;
// Minor version of Flash required
var requiredMinorVersion = 0;
// Revision of Flash required
var requiredRevision = 115;
// -->
</script>
</head>
<body bgcolor="#ffffff">
<!--url's used in the movie-->
<!--text used in the movie-->
<!--
Coping
with
Growing
Audio
Series
Theraputic stories
for children aged
4 to 9
-->
<script language="JavaScript" type="text/javascript">
<!--
if (AC_FL_RunContent == 0 || DetectFlashVer == 0) {
alert("This page requires AC_RunActiveContent.js.");
} else {
var hasRightVersion = DetectFlashVer(requiredMajorVersion,
requiredMinorVersion, requiredRevision);
if(hasRightVersion) { // if we've detected an acceptable
version
// embed the flash movie
AC_FL_RunContent(
'codebase', '
http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,115,0',
'width', '120',
'height', '600',
'src', 'Advert_long',
'quality', 'high',
'pluginspage', '
http://www.macromedia.com/go/getflashplayer',
'align', 'middle',
'play', 'true',
'loop', 'true',
'scale', 'showall',
'wmode', 'window',
'devicefont', 'false',
'id', 'Advert_long',
'bgcolor', '#ffffff',
'name', 'Advert_long',
'menu', 'true',
'allowScriptAccess','sameDomain',
'allowFullScreen','false',
'movie', 'Advert_long',
'salign', ''
); //end AC code
} else { // flash is too old or we can't detect the plugin
var alternateContent = 'Alternate HTML content should be
placed here.'
+ 'This content requires the Adobe Flash Player.'
+ '<a href=http://www.macromedia.com/go/getflash/>Get
Flash</a>';
document.write(alternateContent); // insert non-flash
content
// -->
</script>
<noscript>
// Provide alternate content for browsers that do not
support scripting
// or for those that have scripting disabled.
Alternate HTML content should be placed here. This content
requires the Adobe Flash Player.
<a href="
http://www.macromedia.com/go/getflash/">Get
Flash</a>
</noscript>
</body>
</html>You should use SWFObject to embed your Flash. Not only does
it make
embedding more straightforward, it makes passing query
parameters very easy.
Check out:
http://code.google.com/p/swfobject/
Dave -
www.offroadfire.com
Head Developer
http://www.blurredistinction.com
Adobe Community Expert
http://www.adobe.com/communities/experts/ -
LoadVars-using send to pass a variable from flash to php
For the life of me, I've tried everything:
I've researched LoadVars on Adobe forum, used David Powers'
books, googled 'flash to php', LoadVars, etc. and tried
sendAndLoad, send, and using $_POST, $_GET, $_REQUEST.
$HTTP_POSTVARS but I keep getting this same error. any advice
please?
I have a Unix server running Apache/PHP 4 - LoadVars worked
to load name-value pairs into an array -see thread)
My goal with this simple app is to prototype being able to
pass a variable from flash to a variable in php.
Parse error: syntax error, unexpected T_VARIABLE in
flash_to_SQL.php on line 5
Actionscript 2.0 code:
var c :LoadVars = new LoadVars();
c.testing = "123FOUR";
c.send ("
http://127.0.0.1/flash_to_SQL.php","_self","POST");
php code: (I also tried $_POST, $_GET, $_REQUEST.
$HTTP_POSTVARS)
<?php
//mysql 4.1.2, php 4 , NO mysqli
ecbo $_REQUEST ['testing'];
/?>var formData:LoadVars = new LoadVars();
formData.fname = "Name";
formData.send("
http://www.website.com/flash_php.php",
formData, "POST");
<?php
$name = $_POST['fname'];
echo $name;
?> -
How to pass a variable from one class to another class?
Hi,
Is it possible to pass a variable from one class to another? For e.g., I need the value of int a for calculation purpose in method doB() but I get an error <identifier> expected. What does the error mean? I know, it's a very, very simple question but once I learn this, I promise to remember it forever. Thank you.
class A {
int a;
int doA() {
a = a + 1;
return a;
class B {
int b;
A r = new A();
r.a; // error: <identifier> expected. What does that mean ?
int doB() {
int c = b/a; // error: operator / cannot be applied to a
}Thank you!elaine_g wrote:
I am wondering why does (r.a) give an error outside the method? What's the reason it only works when used inside the (b/r.a) maths function? This is illegal syntax:
class B {
int b;
A r = new A();
r.a; //syntax error
}Why? Class definition restricts what you can define within a class to a few things:
class X {
Y y = new Y(); //defining a field -- okay
public X() { //defining a constructor -- okay
void f() { //defining a method -- okay
}... and a few other things, but you can't just write "r.a" there. It also makes no sense -- that expression by itself just accesses a field and does nothing with it -- why bother?
This is also illegal syntax:
int doB() {
A r = new A();
r.a; // error: not a statement
}Again, all "r.a" does on its own is access a field and do nothing with it -- a "noop". Since it has no effect, writing this indicates confusion on the part of the coder, so it classified as a syntax error. There is no reason to write that.
Maybe you are looking for
-
MY Powerbook 12" S.M.A.R.T. is failing i Need a New HD?
I was listening to music last week and my PB was running slow so i restarted it and it took forever to login and after i logged in I went to disc Utility andd it said "This drive has reported a fatal hardware error" So I backed everything up and i go
-
Hi, anyone used BLOB or BFILE before? Currently I am thinking of using BLOB or BFILE to store documents (.doc, .pdf, .ppt, .rft, .csv). Can decide yet on which to use. Anyone got any recommendation on which to use? 1. Any performace issue when using
-
Dreamweaver and PHP Help Needed!
If there is anyone out there who can help, I am working with a back-end secured website that is in php and need to manipulate and change pageson-the-fly. I'm not sure how to view and actually see in Design View my PHP page, as I can best work in Desi
-
Hello everyone, I'm fairly new to flash web design. I have designed 2 websites so far. www.byfaithmusic.com and www.gravityyouth.com. I haven't had many problems with our group website (By Faith Music), but I am having a difficult time with the lo
-
Hello, I have had a good bit of time spent on this today, and with alot of input from paypal (to no avail) I have sorted it for myself. If you have loads of old addresses that are now redundant, this is how you get rid of them (its probably a bit lon