I have a SubReport with a textbox, I would like to read the value of this textbox and then put it in the main report for each data row.
My SubReport is in a data column.
If you are using Visual Studio, you should be able to drag and drop the sub report object into the text box and configure it from there. But make sure that if the sub report expects parameters, you send the required parameters.
Related
I have a question similar to this one:
How do you populate an SSRS TextBox with a DataSet value?
I'm on old release 2012 R1 and designing report in Visual Studio 2010 shell.
I want user to enter a specific order number, and thus the query will return just one row. I want to show the fields down the page (better for viewing/printing), instead of across the page like the normal table does (especially if I have so many fields that they don't fit on the width of one screen).
Example:
Don't I just bind the textbox to a database field on the properties using DataElementName. That's what I didn't understand about the post I referenced above.
I think I figured it out. I clicked Action then was able to select the database field from a list. After that, I also noticed I can right click, then click "Expressions", and the following screen appears:
The BIRT documentation states that when I add a ? marker in the where clause of the SQL query, BIRT will automatically create a placeholder parameter that I can then edit appropriately. I've added the markers, but nothing ever appears in the Parameters list for the dataset. Am I missing something? If I create a parameter without first having a placeholder, can I somehow associate it with the appropriate marker in the query?
The parameters are not generated automatically.
You'll have to add them manually.
After finishing the SQL SELECT statement, edit the Data Set and choose the entry "Parameters" from the menu on the left side. Then, for each "?" in the select, add a parameter using the "New..." button on the right side.
I've been reading Telerik's documentation and I'm not sure if this is possible: I'm being asked to add tables to a report at run time, without doing so programmatically. A query is run that fetches hierarchical data, and the report owner would like to add a new table to the report for each member of the topmost parent, so that each topmost parent has their own table, with a text box title on top of the table containing the parent's name, in the following pattern:
TopParent1
[Parent1's table]
TopParent2
[Parent2's table]
...
Does anyone know how I could go about doing that without doing so programmatically? Every example and/or bit of documentation I've seen pertains to programmatically adding tables.
It is possible to add tables to a report at run time, without doing
so programmatically?
R: It's not possible to add table with out saying programmatically : the size of each element , the exact position , etc .. .. ..
HowTo create a 'hierachical' report with conditional display ?
1/. Hierachical Report.
Read the telerik official tutorial on How to: Create a Master-Detail Report Using a SubReport Item
Using the SubReport report item you can display one report within another report. The data for each SubReport can be completely different.
But You can achiev Parent/chield relation by Passing Parameters to a SubReport.
/!\ Caution /!\
Page sections are not related to the report itself, but are relative to the paper or screen. Thus page sections of nested/detail reports are ignored and only the page sections of the main report are visible.
In order to have sections that repeat on every page similar to page sections, consider using an unbound group (no grouping criteria specified) and set the PrintOnEveryPage property of its sections to True. Be aware that you cannot use PageCount and PageNumber global objects in group sections.
2/. Conditional Display
You will need to hide Report if subreport have no result.
If you want the user to choose if he want some sub report.
You can do it by passing parameter from your calling application to your report constructor.
And use Something like a Bitfield or an enum to choose what to display.
And What about a C# controler in the master report code behind ?
public myReportConstructor(int SubreportToDisplay)
{
InitializeComponent();
Hiden_Display(SubreportToDisplay);
}
private void Hiden_Display(int _code)
{
if ((_code & (int)myEnum.InfoClient) != (int)myEnum.InfoClient)
HideNShrink(SUBREPORT_CLIENT);
if ((_code & (int)myEnum.Item) != (int)myEnum.Item)
{
HideNShrink(SUBREPORT_Product.Item1);
HideNShrink(SUBREPORT_Product.ItemTWO);
}
}
private void HideNShrink(ReportItem target)
{// http://www.telerik.com/support/kb/reporting/details/collapse-the-container-when-hiding-child-report-items-
target.Visible = false;
target.Height = Telerik.Reporting.Drawing.Unit.Pixel(1);
}
I use a little trick here in my designer every subreport item is set to public:
private Telerik.Reporting.TextBox textBox17;
public Telerik.Reporting.SubReport SubReport_Client;
public Sub_Client sub_CLI1;
When hidding Client I will use the SubReport_Client.
That is the SubReport item, the container of my SubReport Sub_Client ;
(Yes they name the container and the containt are the same name, thats confusing at First, but it's Vs/Telerik choice)
When hidding a Sub Report That is in an other Sub Report.
I use the ContaintSubReport, Container of the nested-nested SubReport.
like: sub_CLI1.nested-nested_SubReport
I was able to answer my own question as follows:
Create two blank reports.
On the report chosen to use for the detail report, remove the report header and footer.
Add data source and parameter/s to the detail report (in my case, an SQL data source) and set report data source to the data source created here.
Add group to report with the value of groupings set to the top-most result in query bound to report. (Groupings = Fields.Parent)
Create text box with the value set to the field for the top result (textbox1.Value = Fields.Parent) or use data explorer to drag and drop Fields.Parent into the group header.
Create text boxes to mimic table column heads (one text box for each title of the columns) and place them into the group header with the text box containing the topmost result (or Fields.Parent).
Drag or create text fields for the rest of the fields in the query (Fields.Child1, Fields.Child2, Fields.Child3, etc) in the detail section of the report, aligned vertically with their column header. Preview the report--it should contain a table-like structure that repeats on each top result.
Switch to other report.
Add same parameter/s to that report.
Add subreport item to the detail section of that report.
Set subreport report source to Type and report document, then select the name of the detail report (the first one created here).
Set parameter/s for subreport to the same parameter/s used in the subreport.
Using that, I was able to essentially add a table per item in the first column of the query. The report created first serves as a wrapper for the query, and because it's being placed in the other report as a subreport item with the grouping I created, it is allowed to repeat as much as it needs to in order to display all the rows in the query.
I used the Telerik documentation for master-detail reports and report structures for this.
I have a report, and a linked subreport. The subreport is linked on a field on the main report.
A field in the main report should link to the subreport at run-time, but when I run it, keep on getting the prompt "Enter parameter values".
The field in the main report is linked to the subreport using the automatic parameter name in the subreport, and have the "select data in the subreport based on field" checked, and the corresponding field in the subreport (shown in the attachment).
I am using Crystal for VS 2013.
This is a winform application.
What am I missing?
I seemed to have the same issue under the same parameters you described. Moreover, while debugging, the winforms app would throw a COM exception. Context switching between VS and the report would reveal the prompt for the subreport parameters (which should have been linked).
An hour of exploring and trial-and-error later, here is how I managed to resolve the issue in VS2013:
On your main report, right-click the subreport and select 'Change Subreport Links...'
Ensure that you have the correct subreport selected, the move across any missing parameters from the 'Available fields' box
For each item you move across, ensure that you have the correct subreport parameter selected in the 'Subreport parameters field to use' drop down list. For parameters, this will generally take the form '?#ParamName'
That got the report working for me again. I hope you have some luck with it!
Apologies for these recent newbie questions, but I'm obviously not asking the search engines the correct questions.
I have a report I'm trying to reconstruct after upgrading from VS2008 to VS2010 introduced errors into an existing Crystal Report. So, I have a semi-working report I'm trying to duplicate.
I have a report containing some subreports. The Main Report has some parameters in queries within "Database Fields" and I need to pass those fields to a particular Subreport's "Parameter Fields" so that it can then reference those parameters in its own queries.
So, my question is: How do I create the association between the query result on the Main Report and the parameter on the Subreport?
For Crystal Reports for Visual Studio 2010 - That's the only one that works currently, isn't it?
When adding a sub-report [or changing the "Change Subreport Links" for an existing report] you can select the parameter on the subreport from the drop-down on the bottom left of the 'Links' tab (or Subreport Links dialog, if editing an existing subreport)
Once you've selected your field (or Parameter) on the left in the 'Available Fields:' list, click the > button to move it to the right and you'll see link options appear below. so this is the field from the main report you want to use as a parameter for you subreport
Underneath, on the right select the parameter (from you subreport) you wish to link it to. This is the parameter in your subreport that you want to use
does that make sense.
Maybe some images would help.
Depending on your version, the terminology might be slightly different, but you should be able to right-click on the subreport and select "Change Subreport Links".
From the Available Fields column, find your parameters and click the > button to move them over to the "Fields to Link" column. Click OK when you are done.
Now go to your subreport, and make sure that the parameters you linked are available as parameters; you should be able to use these parameters in your Record Selection for your subreport.