Pass Record Selection Data to Subreport - crystal-reports

I have a main report that uses a formula in the Record Selection. The numbers are set by choosing the "is between" option in the Select Expert. I need these numbers to go through to the subreport, however, no matter what I do, I can't get both numbers through to the subreport, just the one. Is there any way I can pass both these numbers through to the subrport? Neither of them are based on parameters, we use a system here at work where the parameter is set at runtime.
Attached is a picture of the main reports' Select Expert - I need to get the 2 and 6 through to the subreport. Is this possible?
Thank you.

The answer in the link below seems to work, if you have a similar problem. To quote:
Create two formulas
MinValue as Minimum({vw_P_SDL_MTDSummaryList.PAYROLLDETAIL_ID})
and MaxValue as Maximum({vw_P_SDL_MTDSummaryList.PAYROLLDETAIL_ID})
and pass them to the subreport as a parameter without linking it to any of the > field in sub report.
http://scn.sap.com/message/16971134#16971134

Related

Including a subreport into a GROUPING section

Crystal Reports: including a subreport into a grouping section?
asked the same question, but I am hoping a comment on the accepted answer is wrong: that it can't be done because the subreport must be in the details section. Also, what the selected answer says to do isn't working (perhaps because of the other detail, no pun intended).
So this looks like a duplicate question, yet the original question does not appear to be answered, and certainly the accepted "answer" is not usable by me.
(see also How to handle a duplicate question when the original has an accepted answer that is not really acceptable?)
My subreport can list one to many items, each of which can join to one or more items in the main report details. The common field they join on is the grouping item. So, for example, the subreport might have three items and the details five, but if I put it all in the details, I would have fifteen rows, with the first part repeated five times and the second part three times.
The common item appears as a "command field", a "report field". and the Group item. But no matter which of those I link as a subreport parameter, the subreport gets nothing and asks me to enter a value when I try to view the report.
In a more recent version of Crystal Reports you have two options: You can either connect the subreport to a value on the main report via the subreport parameter dialog. or you can pass a Shared Variable between the reports. If you are using the subreport parameter dialog, then the value passed in will be whatever that value is at the time the group is displayed. If the value comes from a detail in that group or from a variable on the main report it shoud pass fine. If the value is something that would be displayed after the group is displayed on the report (going top to bottom) then the value won't be written yet and will be passed to the report as null or blank.
Shared Variables are shared between a report and all of its subreports. If you need to get data from a subreport or pass a single value to multiple subreports, it might be the better option. If the shared variable is changed in the report or a subreport, it'll use the new value in everything after that.
SAP has a good guide on both techniques here:
http://scn.sap.com/people/ashish.bamzai/blog/2011/11/23/passing-values-between-reports-crystal-reports-2008
Bear in mind that Crystal Variables are always populated based on their position in the report and the order they are printed in. If something needs to happen after another group or subreport prints, you'll need to use the WhilePrintingRecords keyword.

SSRS Aggreation on Calculated Field

I am trying to perform an aggregation on a calculated Field in SSRS and am getting the following error:
[rsAggregateReportItemInBody] The Value expression for the textrun 'Textbox43.Paragraphs[0].TextRuns[0]' uses an aggregate function on a report item. Aggregate functions can be used only on report items contained in page headers and footers
This is the formula I tried to use:
=Sum(ReportItems!PlanPurchPrice.Value, "Select_UCPUtilization")
In this Case PlanPurcPrice is also an Expression:
=First(Fields!PawPlanPurchPrice.Value, "Select_UCPUtilization")
Any suggestions on this would be greatly appreciated.
SSRS 2008 does not support the functionality you are looking for unless the report item is located in the header or footer (as is stated in the error message). I would, instead, propose two alternate solutions:
First Option
Place the calculation in your query (if possible) at which point you can then reference the field and the aggregate will work as desired.
Second Option
You essentially want to create the aggregate you're looking to return elsewhere in the report where it is directly connected to the Select_UCPUtilization scope, then reference the aggregated value elsewhere. Follow these steps:
Within the same scope as report item PlanPurchPrice, calculate a sum of the PlanPurchPrice. Name the textbox containing the aggregate something meaningful (e.g., Sum_PlanPurchPrice).
Reference that textbox directly wherever you were trying to use the ReportItems sum before (i.e., =ReportItems!Sum_PlanPurchPrice.Value)
Hide the workaround. Place the aggregate you created in an additional column or row attached to the Select_UCPUtilization scope. Turn the text white, turn off growth and shrinkage, and make the row very tiny (a pixel or two high).
Using the second option, the report item does exist (and is visible, which is important) on the report and contains the sum you are looking to return elsewhere.
Hope this helps. if this doesn't make sense, please reply via comment and I'll help you to the best of my ability.

Jasper Report group subreports using columns

I have a master report (using iReport 5.0.4) with a subreport that uses grouping by a field called "Group Number" (sorry, but that is the actual column name).
My report works fine when there are more than one group, but it generates each group result scrolling down the page vertically.
I would like to be able to have each group go across vertically, but when I tried using columns, it simply forces each group's data into columns, and not the entire group 1, followed by group 2 in the next column, etc.
There can be up to 8 groups, so I was hoping not to have to create 8 individual sub-subreports with a "print when" expression to show/hide them.
Can anyone tell me if this should be possible?
Thanks,
Mitch
I think making subreports is the easiest and obvious way. But if you want to make it in other way, I can only suggest to use scriptlet, and form dataset manually (Transpose it).
Another suggestion is when you generating report directly from database (i.e. passing connection into jasper) you can modify query and transpose the data (PIVOT table).
Anyway provide more info about your case. I will try to help you.

How to suppress specific bar on bar graph in crystal reports?

So I am trying to suppress a specific bar on my bar graph. So instead of populating the graph from the database, I am populating it from a formula field. So in my formula field, I have something like this:
if field <> "Member" then
formula = field
So it gets rid of the field however it leaves me with this:
I know I can make a subreport that gets rid of that field from the beginning, but I was hoping to avoid creating a subreport for this.
Any ideas? Thanks!!
Instead of leaving the group name as blank when the field is "Member", I suggest changing it to be the same as another group which you can always expect to appear on the report - perhaps "SR not handled timely".
This would lump in all the member values with the other group's values, so if you haven't already done so, I suggest graphing the value of a derived field which is set to 0 for "Member". (I suspect you have already done this, as the blank group is showing a value of 0.)
The least error-prone method is probably the subreport. If this report is very dynamic, and you always want to hide group A in the graph regardless of it's value, then this is the best way to go.
If a static number of groups will be appearing in your graph, you can limit to display the top N groups. i.e. If there are 7 groups total, and you only want to hide 1 of them (which always has a value of 0), then you can display the Top 6 groups (picture is of Crystal XI):
Thanks for all the help guys, the data will be pretty dynamic.. So I am going to go with the subreport. I will add those little tricks to my toolbox though! Thanks again.
Alternatively, you can set a "specific order" and only include the values you want to include in your graph. In the "Other" tab you need to select "Discard all others".

crystal report problem

what is the equivalant command like in vb for EOF(), MoveNext, Moveprevious commands in crystal reports
There are no equivalent answers in Crystal Reports, at least not in the versions I have used. Crystal Reports more or less simply dumps the data out into the report.
That said, if you are in a detail row, and you want to find out what the next value of a field will be, you can use:
next({YourColumn})
You can also find out the previous column value by using this:
previous({YourColumn})
Keep in mind that Next() won't work on the last record, and Previous() won't work on the first record.
I'll have to double-check, but I believe there is an OnLastRecord function that returns TRUE if you are on the last record.
First, welcome to SO!
Second, you sound new to Crystal Report's purpose is to display data, not perform the kind of calculations you're talking about. CR usually goes record-by-record through the data, displaying (or suppressing) each record, and adding group headers & footers.
To answer your question, LittleBobbyTables does give a few good pointers. To see the entire list of functions available to you, there is a list in the Formula Editor (see pic below). Press F1 for detailed descriptions of each command.
You can also:
Create a "Running Total Formula" that will evaluate each record and give a calculation in the group footer.
Do the calculations outside of Crystal Reports and only feed the end result in (perhaps with an unlinked join to your primary table).
The most complex option is to make a subreport that does the calculation and feeds the result back to the main report
Can you give us some more details about what you're trying to do?