Create Crystal Report Variables from Detail - variables

I have a problem with reports and subreports.
I would post a screen shot but not got enough reputation.
I have added the screen shot as my profile picture.
In the example the order number is derived from the PO and the number of lines and order number varies for each PO.
I want to be able to capture the Order Number as a variable for each detail row to be able to pass this variable to another report.
The reason for this is i need to use the order no to select data in another report.
I can capture the range of order numbers using minimum and maximum in a formula, but there are a lot of order numbers between the min and max that are not required. I only need the numbers shown in the primary report.
I hope that this makes sense.
Regards,
Alec

Related

Make a Crystal Report selective over the data that it shows

I have many reports in a project, each showing different data about different things. I have shown the user the project, and his main feedback was this:
I like the reports, however I notice that in a lot of them, the tables show all of the columns that meet the report criteria (what the report is showing), even if they are empty. Can you change them so that if a column is empty, it is not displayed, as this takes up needless space?
Is there a way I can achieve this? For example, if the report is Sales by Customer x by Suppliers, and one supplier has no data for this customer, I don't want that supplier to be shown. Is there a way I can get the report to only display columns if they contain data?
To clarify, the effect I am after is, if the report below was shown, the column Arris Rail (144) 75x75 1.282m would not be displayed.
Right click on crostab > Cross-tab expert > customise style
set option Suppres empty columns
I think you need to replace "-" value to null or empty

SSRS: How To Create Dynamic Report With Multiple Subreports?

I am still fairly new to SSRS, and I do not know what I need to/can provide as examples to help clarify my issue.
I am developing an SSRS report that accesses a NAV database and generates a report for an equipment number. My task is to generate a master report that can print multiple of those kind of reports(currently 10 max). I am using sub-reports to get the content that I need for an equipment number.
I am looking for a way to make this dynamic, where I can generate 1 to n sub-reports based on how many values were picked for the multi-value parameter. The end result should be one PDF file that contains the full report for each equipment number listed. I am trying to only use SSRS.
I have seen where I could hide sub-reports then make them visible if a condition is met, but this isn't the functionality that I am looking to use. So, what would be the best way to dynamically generate sub-reports based on a multi-value parameter?
I figured it out. I made the sub-report parameter equal no value. I made the main report with a parameter that can select multiple equipment numbers, a list, and a data set which filtered down to the appropriate equipment numbers to avoid duplication. I made the sub-report object in the main take in the cell value from the list equipment number. When the list proceeded to the next row, it copied all of the objects in the box area.

SSRS MAtrix/Tablix

I have a report in SSRS report builder 2008 that has a chart that is a definitive size. I would like to make the matrix table fit neatly under the report as it would in excel. However it expands way past the report. I have tried turning can grow can shrink to false did not work. I have tried putting a rectangle and placing the matrix in there with no success. I tried setting the size in the tablix properties but it extends or shrinks below based on the data in the tablix. The tablix is just 6 lines the top line is a expression for the date and then there is previous year previous cumulative current yeat and current year cumulative and receipts %to last year. i have included the expresssions I used in the tablix not that I think it is causing the issue Any help will be greatly appreciated
=Sum(Fields!ID2013_Inventory.Value)
=Sum(Fields!ID2013_Inventory.Value)
=RunningValue(Fields!ID2014_Inventory.Value,Sum,"RECEIPTS_IND_DEC")
=SUM(Fields!ID2014_Inventory.Value)/SUM(Fields!ID2013_Inventory.Value)
Sorry I didn't follow up your comment earlier, it's been busy here...
There is a sledgehammer approach to this that will work, not sure if there is a more elegant way but here goes.
Fist some basics...
Determine how wide your matrix needs to be, let's say 25cm
Let's assume you have a couple of columns on the left that are both fixed at 2cm each. That gives us 21cm to put our varying columns in.
For now assume we only have 28 days, so we need to set the column width of the column group to 0.75cm (21/28).
Test and make sure everything looks OK.
Now here's comes that sledgehammer!
Make another 3 copies of your matrix and adjust the column widths for the next three number of days (so 29,30 & 31).
Now set the visibility of the of each matrix so that it only shows when the related number of days are returned in the dataset.
I don't know what your dataset looks like so I can't give much advice on determining the number of days returned but I often create another dataset that gets the value, in your case something like
SELECT COUNT(DISTINCT MyDateColum) as DateCount FROM MyDates
Or I guess you could probably base visibility on the month and whether its a leap year or not.
Hope that helps, if any of it is unclear let me know and I'll try to get back a little quicker this time.

why use beforereadingrecords / whilereadingrecords / whileprintingrecords in crystal reports?

I know crystal reports has 3 phases when it renders a report, and depending on the phase it may read static data or grouped data fields etc, but is there any benefit writing formulas in any of these phases? The end result should always be the same if I specify the phase or not?
The end result will not always be the same and omitting evaluation time functions can sometimes lead to incorrect results. For example, consider that you have a report that is grouped and that you are trying to calculate simple subtotals for these groups with a variable. Say you are resetting the variable in the group header and displaying it in the footer while updating it in the details section via:
numbervar subtotal;
subtotal := subtotal + {table.numericvalue}
Crystal will evaluate this formula while reading records and before the records are in a predictable, grouped, and sorted order. It's not until the second pass, the whileprintingrecords pass, that records have been grouped and sorted. That's why group selection happens in this pass.
This is just one example, but there are a number of ways to break a report by omitting evaluation time functions, mostly having to do with using variables (at least that I can think of). Here is a great resource for details on Crystal's multiple passes: The Multi-Pass Reporting Process of the Crystal Reports Engine

SQL code for identifying if there is a new value

I have a crystal report that I need to set to produce a new page when an id number changes. What is some SQL code to identify when a value changes for a column. Say this column is named ID and it is an arbitrary set of numbers 0000000 format etc, how can I code to know when this number changes?
You don't need SQL for this.
In your report, open your Group Expert. Group your report by your unique ID. You will now see 2 new sections in your report design, a Group Footer and a Group Header.
Open your Section Expert. Click on the Group Header to access the options therein. Turn on the New Page Before option.
This can be done within Crystal Reports. Perform a grouping on the column, and tell it to apply a new page break after in Section Expert.
Grouping is probably better, but if that doesn't work for you, try the Previous() and Next() functions in the Formula editor to see if the value of the field has changed or is about to change.