I have two datasets I need to pull from, A base that both reports use and then a separate one that only one report pulls from. I get the error
Error 12 The Value expression for the text box ‘Textbox9’ refers to
the field ‘Name’. Report item expressions can only refer to fields
within the current dataset scope or, if inside an aggregate, the
specified dataset scope.
My best guess is I have to associate them with the correct dataset but I have not been able to find any documentation on this.
edit: I am trying to access property files that I created for the fields on the report document.
Can someone please tell me where in the rdlc document I need to code something like name.value, "dataset1" or something similar?
When you create a table in a RLDC, in the Tablix properties (selecting a row or a column) you must associate a DataSet.
After doing that, you have to write in each cell the name of the field (in the dataset) that you will use. You can do that by clicking on the "little table" in the cell, when you put the mouse over it
In images (with Visual Studio 2010)
If you don't see the dataset in the list, you must add it.
For that, click on view menu -> report data.
Then, in the DummyDataSource, click Add Dataset..
And select it from the list, or create a new one instead, in the same form.
If this doesn't work, well I don't know haha
If the two datasets has the same structure, then you could use one just, and in the code assign it to the datasource
I ran into this same error and the only way I could resolve it was by closing and reopening BIDS and then refreshing the fields from the stored procedure (Right click the data set -> Dataset Propoerties -> Query -> Refresh Fields).
Thanks for the troubleshooting tips!
If you are trying to embed the results of one set into a table that is using another data set, have you considered a subreport?
After some careful research and error checking I found that I had to create my base model property file and when I drag the actual data points on to my form I had to associate them with their correct set:
I clicked the value and associated the correct dataset.
Related
i am doing a Lab Test web application Project.In this ,Customer will apply a order with list of lab Test.Once the lab test completed , i need to create a report with all the test conducted. The test will be different from each other.i can create a query for desired result.but the Table columns will be dynamic and number of tables(different test have different table) also will be dynamic.
As far as i know , we can create one static report format and bind the data table to it.or we can create a row group and colum group in matrix(i got from some links)and dynamically hide and visible the column.
my requirement is bit different and i can't make it static. is there any way to do this dynamic in SSRS Or any other tool ?. Or i have to go back to old school where i need to create report format(excel,pdf)in code(C#). Please advice some tips, Links or article which can solve this issue. help is appreciated.
As far as I understood your requirement, you need to have different tables(in regards to columns and style) for different tests.
For this you just need to add seperate tablix for each test (assuming you have limited number of tests) and then you need to set filters and visibilty expression on each tables based on specific 'test name'.
Just Right click on top-left corner of the tablix.
Click on Tablix Properties.
In Tablix Properties window:
Go to Visibility Tab for setting expression for show/hide the tablix.
Go to Filter Tab and add value and expression for filtering dataset.
I hope this fulfills your requirement.
Given a data set containing multiple rows, from within a .NET console application I need to generate a report on a single page for each row, sending those pages directly to the printer.
I am attempting to use Microsoft Report for this by attaching it to a data set and placing TextBoxes where I wish. Generating the report and sending it to the printer are not a problem. Unfortunately, the data only seems to be available in aggregates -- First, Sum, Last, Max, etc. I cannot latch the text box to a bare field.
Some poking around here and other sites seems to address this, but only when the data is presented in a table. One post even said without elaboration, "My mistake was using Text Boxes"
Am I using the wrong tool for what I am attempting to accomplish?
I ran into the same problem and managed to solve it. The solution seems a little convoluted to me so don't quote me on the "right" way to do this, but here is what I did:
Make sure you have a Dataset defined for your report.
Add a "Table" control to the report. This seems to be needed in order to iterate the rows in your Dataset.
Delete the header row and two of the default columns from the table so that you are left with a single row with a single column.
Expand the table to the width of your layout and make it as tall as you will need for your "free form" layout.
By default, there is a TextBox inside the table cell. Right-click the empty table cell and choose "delete" to remove that TextBox.
Drag a "Rectangle" control into the empty table cell. It seems to automatically "dock" to the width/height of the table cell.
Now you should be able to drag the fields from your DataSet (TextBoxes, etc) into the Rectangle to produce the desired layout.
Note that I am in the early stages of using this approach so I'm not sure if I am going to hit any walls... but for a basic report that uses TextBoxes and a page break after each "row" it seems to be working ok.
Or you try to use a list.
In the list you can arange textboxes (and other controls) as you want and they will be filled for each record in the recordset.
This work for me. :-)
Help Please!
I don't know what I have done!!!
I have a datagriveview data bound .Net 4 C# windows forms app. At some point I changed the Connection string to one in code as I didn't want it seen in a config file. now when I try to pick up a new column from the database and add it to the grid View I get and error saying it can't find the connectionString.
I have re added it to the Properties settings but still get the same error!
How do I trace back from the datagridveiw to find where its picking it up from so I can add a column manually.
It uses a dataset.xsd which where I see the error re connection string.
So in summary I have a datagridview that I'm trying to update manually to pickup a new column in the database.
Go to your dataset and find the tableadapter that you are using to populate your data with. Click on the part of the adapter that says "SomethingTableAdapter" (in orange in the SS below). When you click the "connection property" does it allow you to select the connection string you have located in your Settings? If not select it.
I'll edit my answer to help you if that doesn't do the trick, but I'd assume that when you deleted the connection string the first time, the tableadapter itself lost the reference to it as well.
I'm taking a look now to XtraReports reporting tool and there's something that I don't get it yet.
How do I set the data source for a certain field (showed in the report as a Label I guess), without having to build a connection, adapter and dataset at design time but doing it programatically.
For example, I can have a table called "User" with 3 fields: UserId, Username and Password.
In the report designer I place 3 labels (and here's my question) set the datasource for showing the 3 database fields.
Then, in the code behind, I create a connection, execute a command, fill a dataset, create a report instance, pass the datatable to it and show the report preview.
Is this possible? Let me know if it isn't clear enough.
Thanks!
You could set your Report's DataSourceSchema property to an XML schema that represents your DataSource. That will let you use the Report Designer to set your data bindings at design time without establishing a connection to the database each time.
Here's how I do it:
Once I have my report query mostly finalized, I run the code once with a call to
myDataSet.WriteXml("C:\myDataSourceSchema.xml", System.Data.XmlWriteMode.WriteSchema)
Then in the report designer I set the Report's DataSourceSchema property to the newly created file. This will populate the Report Designer's Field List tab so you can bind at design time. That way you only have to have a valid data source once (or any time you change your columns). You can definitely still do Przemaas's approach and do all of your data bindings in code, but I prefer to let the designer handle most of the work.
Building a report without a dataset, you would use an IList object ... so follow this nice tutorial
How to: Bind a Web Report to an Array List
https://documentation.devexpress.com/#XtraReports/CustomDocument3851
Yes, it is possible. You can define necessary databindings in the code:
this.xrLabel1.DataBindings.Add(new DevExpress.XtraReports.UI.XRBinding("Text", data, "Name", "aaa"));
Text here is property on the XrLabel
class. I assume that you want to
display bound field as text in label.
data is your object with data
"Name" is name of field that you want to display
"aaa" is display format, applicable in case you want to display values with custom formatting
Basically databindings in XtraReport act pretty much the same way as standard windows forms databindings.
Let me know is you need more guidelines
Here is an alternate..
rtpObject.DataSourceSchema = dataSet.GetXmlSchema();
before doing this set modifier property as public
InvoicePrinting_Rpt InvoicePrintingRpt = new InvoicePrinting_Rpt();//report object
InvoicePrintingRpt.BillDetails.Report.DataSource = ds_Invoice;
InvoicePrintingRpt.Report.DataMember = ds_Invoice.Tables[0].TableName;
//bellow third parameter as your column name.
InvoicePrintingRpt.lbl_BillHead.DataBindings.Add("Text", null, "BILL_DESCRIPTION");
InvoicePrintingRpt.lbl_Det_Date.DataBindings.Add("Text", null, "TRANSACTION_DATE");
InvoicePrintingRpt.lbl_ISINCode.DataBindings.Add("Text", null, "ISIN_CODE");
ReportViewer1.Report = InvoicePrintingRpt;//assign report obj
ReportViewer1.Report.Name = "DevExpress_Reports.InvoicePrinting_Rpt";
ReportViewer1.DataBind(); //binding
XRBinding binding = new XRBinding("Text", ageingBindingSource, "ageing_contactsLookup.name");
this.xrLabel19.DataBindings.Add(binding);
// or //
XRBinding binding = new XRBinding("Text", dbaDataSet, "transactions.fk_transitems_transactionid.name2");
this.xrTableCell1.DataBindings.Add(binding);
I have two local data sources that I can push into the report. Works no problem. But how do I set up the report? One data source contains a list of employees, and info about them. The other contains a bunch of working hours for each employee.
I would like to use a table for the list of employees, and then have another table for the working hours beneath each employee (with their working hours).
Is this even possible? Do I have to use a Sub-Report? Would I have to merge them into one datasource? =/
As far as I can tell, it is impossible to nest one dataset inside of another one without using a subreport.
This means you need to do one of two things:
Refactor your two datasources into a single datasource. For example, perform a join between the employees and the working hours for each employee. You can then use the grouping properties of the Table object to format the list the way you want it.
If joining the two data sources is not practical, you can use subreports to accomplish what you want. Create a subreport containing the working hours data source and give it a parameter for the current employee. Filter the working hours by this parameter.
In your parent report, you can place the subreport in the list, and pass the employee ID for the current row as a parameter.
Note that there are a few formatting quirks involved with using subreports. I've been able to work around them in most cases, but the preferred method would definitely be number one above.
Adding a new answer to make sure a notification is sent for it.
Using a subreport is the easiest method when it works. You can simply drag and drop a subreport onto a table cell, and it will fill that cell's content area. Right-clicking on the subreport will allow you to edit the parameters for the subreport. Like most values in SSRS, the parameters can be set to expressions which use the fields in the table.
Within the subreport, just filter your results to show only the records associated with the employee who was passed in as a parameter.
The other route you can take is to merge your two datasources using a join. This will give you data something like this:
employee1 time1.1
employee1 time1.2
employee1 time1.3
employee1 time1.4
employee2 time2.1
employee2 time2.2
employee2 time2.3
You can then create a group on the repeated columns (employee in this example), and enable the HideDuplicates property on those columns. The result will look like this:
employee1 time1.1
time1.2
time1.3
time1.4
employee2 time2.1
time2.2
time2.3
To set up multiple datasources...you need to place two separate list objects into the report. Go to the designer, and in the toolbox you can put a new "list" into it. Then, you can do another report. Link that second list to your secondary dataset, which you implement through the secondary datasource.
It's a little bit of a stretch, but the basic idea is that each list object in the report can only be linked to one datasource.
In the report document class there is a property called "Database", which has a collection of tables. You can use "SetDataSource" on each one of those tables, in order to place the separate lists of objects into the report.