SSRS Dynamic Hypherlink - ssrs-2008

I have a report that list different report names, but I wanted to add a dynamic hyperlink that when the report name is clicked that report will run. Note that the report name is not always the same, it changes daily. So far, I only know how to add an Action either Go To Report or Go To URL and this is on a single instance.

You can put the report name in an expression for either the Go To Report or Go To Url Actions.
You can reference hard-coded values, or have the report name in a field in your data.
In this example, the Report Name field is used as the report to go to when the text is clicked.
You could also hard code the values and choose based on another condition using an IIF statement.
Then have an expression to inserst the desired report name into a string with the rest of your URL for the report server.
="http://sql01/Reports/Pages/Report.aspx?ItemPath=%2fDepartments%2fReporting%2f" & IIF(Fields!RECORD_TYPE.Value = 1, "Report1", "Report2")
How you do it would depend on where the logic is for choosing which report to show. Is your query going to return the report name or are you going to use other logic in the Go To Action to determine which report to go to?

Related

Crystal Reports - Subreport with stored procedure as datasource creates a new param and doesn't pass it to the stored proc

Using Crystal Reports XI, I have a main report. In this report, I have a Formula Field named XXXCompanyFilter. This is set programmatically at run time and I want to pass it to a subreport.
I add a subreport that has a stored procedure as an input parameter. The parameter is named #co.
A Parameter Field is automatically created in my subreport called #co.
I return to my main report and right-click the subreport and choose Change Subreport Links. I choose the Formula Field XXXCompanyFilter from the Available Fields list and move it to the Field(s) to link to: list.
At this point I expect to be able to choose the subreport's #co parameter in the Subreport parameter field to use: drop down, but it is not there. I have unchecked the Select data in subreport based on field: checkbox.
I've tried selecting the ?Pm-#XXXCompanyFilter option, and that (I think) causes a new subreport parameter to be created:
After that, I do get the new subreport parameter to show in the drop down:
However, this new parameter doesn't seem to do anything, and I'm still prompted to enter the #co subreport parameter whenever I run the report. If I enter a value for the #co parameter the report returns the data I expect.
I've created several subreports to see if the behavior changes. I've tried it with the subreport wizard and with subreports I've created normally. I always get a 2nd, non-useful subreport parameter and the #co parameter is never set, so I am prompted for it.
I feel like if I could select the #co parameter in the drop down list it would work as needed.
I've checked out multiple SO posts, and I've googled the issue but everything I find says I'm doing it right. What am I doing wrong, or what do I need to do to make the #co parameter available in the drop down?
I solved this by specifying a database field in the Available Fields list when creating the subreport link and following the instructions in my original post.
Apparently it just won't work if you specify a Formula Field in the Available Fields list. I can't find any documentation on this but that's the conclusion I come to after reaching a solution by trial and error.

Crystal Reports: Setting subreport parameters with one main report parameter [duplicate]

How can we pass a parameter from the main report to a subreport in Crystal Reports XI? I have a parameter in the main report. Now, I want to pass the same parameter to subreports. Please help me.
Right-click on the subreport object and choose Change SubReport Links, then select how the parameter is to be used by the subreport.
Using CodebyMoonlight's solution requires a relation between main report and subreport.
If there is no relation between both of them, you can use Shared Variables to pass values between both of them, as shared variable can be set and displayed anywhere in main report or sub report.
Shared NumberVar x := 5;
Perform following easy steps:
Create New Parameter lets say "StartDate" in Parameter Fields in Field Explorer in Crystal Report
Create New Parameter lets say "StartDateSubReport" in Parameter Fields in Field Explorer in your Subreport
Now in Main report file, Right Click Subreport lets say "EmployeesList.rpt" and click Change Subreport Links menu
Select "StartDate" from Available Fields from Available Fields Tab and click on ">" button to make it vailable to link in subreport
Now bind your "StartDate" which you have made available by selecting it with "StartDateSubReport" in dropdown available in "Subreport Parameter Field to use"
parameter sharing between main report and sub report "Right-click on the subreport object and choose Change SubReport Links, then select how the parameter is to be used by the subreport." works for me
I had the same problem. The main report loaded first and then the subreport. You have to load the subreport before you can use the variable.
I think that using
Right Click and Sub-report Links
or
Shared Var Between Report and Sub-report
Both using Selection formula so it is suitable for limited data only
Selection formula working after loading all records from Database table ... report loading bad performance
so i'm tring to limit rows by passing some parameter from C#/VB and send others from main to sub report
For example if you need the transaction of items in period and you can pass the period parameter from application (c# ..) and using Sub-report Links to send itemID
https://kb.blackbaud.com/articles/Article/52328
Create a parameter field in the main report.
From the main report, right click on the subreport, and select Change Subreport Links.
In the subreport linking window, select the parameter field from the window labeled "Available Fields", and click on the ">" button to move it to the window on the right labeled "Fields to link to"
Below, make sure you have a check next to Select data in subreport based on field.
Below the checkbox, if it is not already there, select the field from the subreport, to which you would like the parameter field linked.
Click OK

Crystal Subreport Common Headers

Maybe someone can Help me find the right technique.
I have a number of Crystal Reports that I am updating (Crystal Reports XI).
These reports each have an SQL Function associated with each that either retrieves records from the database (if any meet criteria) or returns an Empty Dataset (which happens daily).
These are executed in a batch process and directs the output to a PDF file which is emailed to users.
I am relatively new to Crystal Reports.
I am attempting to use a common SubReport to format/gather data for the Headers/Footers used in these documents. So far - most of this is working as I would expect. This allows me to use a single SubReport to generate the same Header/Footer in multiple reports (at least that's my goal).
However - I added a Report Footer section to the Main Report - my plan with this was to generate a Report Footer that would contain the following information:
A static Text Message that reads " --- END OF DOCUMENT ---"
The Report Title of the "Main Report"
The Date and Time that the Document was generated and Total Number of pages.
Sounds pretty simple.
So SubReport is named: "END-OF-DOCUMENT-SUBREPORT"
I used the "Special Fields" Data Date, Data Time, & Page N of M
Since the "Special Field" Report Title is returning me the "END-OF-DOCUMENT-SUBREPORT" value I used a Parameter field to pass the Report Title value from the Main Report to the SubReport.
This all works fine - HOWEVER - with the addition of the Linked Parameter Field from the Main to the SubReport - when I execute the report to generate the document - the SubReport ends up showing a blank Report Footer - that I can click on to reveal the "END-OF-DOCUMENT-SUBREPORT" in another Tab.
Without the Parameter field - it didn't do this and the information from the SubReport appeared on the last page of the document.
Is this a standard behavior of Crystal?
I'm not sure how to Suppress the "Drill Down" feature and still display the Report Section.
You can pass variable between you Main Report and sub Report. You can also create variable and assigned them to a sub report. As aMazing mention, creating Header and Report Footer sub report is not common. It is even messy. If you want something generic, I will create a report template that you will use in the future.
Have a good day!

Iterate through data table in Crystal Report

How can i create function to iterate through datatable to read value from table
e.g
Function GetVal(integer id)
//iterate here and match value from table using id
return value;
and call this function on report field
i am using crystal report 11
any clues??
Option 1: Make your function (or equivalent SQL query) outside of Crystal and link to it like any other source. The practicality of this option depends on the details of your report.
Option 2: Crystal doesn't have a built-in Get() function that I can find. So, you'll have to get creative with subreports. For example, let say's say you want to get {TargetFld} from {LookupTable} based on {CriteriaFld}:
Make a subreport. Use {LookupTable} for your data source.
When entering subreport links, choose {CriteriaFld}.
In your subreport, make a formula. Use it to create a Shared variable and set the value to whatever value you want to pass back to the main report.
Position the subreport 1 section above the section where you need to use this value. (Otherwise it won't evaluate when you expect it to).
Create the Shared variable in the main report.
Use it as normal.
If you're not familiar with subreports or shared variables, I suggest first looking them up in the Crystal help files (F11). This will make alot more sense that way.

Crystal Reports subreports

Here is the scenario where I need help
I ve got a report - XYZ Summary Report (with embedded sub-report) and the XYZ Details report (the sub-report)
The requirement is that the XYZ Details report be a sub-report to XYZ Summary Report and also be available as a Stand Alone report through a Parameter.
Report Information:
1) A Parameter allowing the user to select the report they would like to run, either the XYZ Summary Report or the Agreement Details Report.
2) The XYZ Details Report should also be a sub-report to XYZ Summary Report which would allow the user to launch the XYZ Details Report through the XYZ Summary Report by selecting the linked Document Number.
I dont know if I am clear here. Let me know if you need more informaion
The combination of being able to drill down to the agreement details interactively, and being able to specify whether to run the report at detail or summary level makes this quite tricky - the former is implemented in Crystal using Hide functionality, while the latter requires conditional Suppression.
I recommend not doing the detail report in a subreport if you can avoid it - I find them awkward to develop and maintain. Additionally, due to the need to drill down interactively or at initial run-time, you will need to link to the subreport twice - once for the drill down, and once for the parameterised selection of the detail report. Consider linking the Documents table to the Agreement Details table, instead.
If you have to go down the subreport route, then:
Set up your parameter with an appropriate name (eg ReportType).
Group the main report by Document Number (if it isn't already) and place the detail items in the group header section, with the group footer section suppressed.
Split the details section of the report into two subsections.
Set the first details sub-section to Hide (Drill-Down OK) and add the subreport to it, with appropriate links on Document Number.
Set the second sub-section to be conditionally suppressed (in the Section Expert dialog) based on the value of the parameter, and add the subreport to it, with appropriate links on Document Number.
Alternatively, consider the method suggested by PowerUer, in the comments.