I am trying to create a local mode (rdlc) report in my web application.
The source for my report is an IEnumerable of type Customer, each of which has a nested IEnumerable of CustomerOrders as a property.
I'm confused how to create a RDLC report that can show all of the customers, and for each customer show all of the orders.
This post talks about how to create a dataset with a format that matches your IEnumerable format, and then substitute it at run time with the actual data you want to use, but I don't know how to define a dataset that matches this IEnumerable, and besides it seems somewhat clunky that I'd need to define a dataset for a report when I have a perfectly good type..
Is this possible in RDLC files?
Thanks!
So it turns out that I could do this by following these steps:
1) In a service class, I expose a dummy method that returns an IEnumerable
2) When I create a new local RDLC, using the wizard, I can select this method as the source of the report. I don't have to use that method, but it allows the report to read my type and gives me the properties from my enumerable to use in my report.
3) When it comes to running the report, I can then in my code behind, specify the actual data I want to use for the report:
this.ReportViewer1.LocalReport.DataSources.Add(new ReportDataSource("ReportDataSource", dataForReport));
Hope this helps someone!
Here is a really good example of doing something similar to what you are trying to do:
http://www.gotreportviewer.com/masterdetail/index.html
This also includes code sample downloads. Basically you will want to embed a table into a list.
Related
I have a json array variable defined in my activity workflow definition. Now, I need to present the data of the json array in a datagrid inside a form task. One of those columns should be a check entry filed so that the user may select some rows. After that, I need to get back that data in a subsequent form task (so I need the data to be updated in the json variable so I can read it back, mainly the user selected checks).
Any example to accomplish this? I didnt find almos nothing relating with using datagrids in Alfresco task forms.
thank you!
Miguel
I'm very new to telerik reporting. Please check my issue below.
I have created a telerik report using designer. This report calls stored procedure to retrieve the data and binds to chart.
I'm getting following error message when I generate the report via report viewer.
"The expression contains object 'dtScan' that is not defined in the current context".
I have already added all required report parameters (input parameters). Actually this 'dtScan' is not an input parameter. It is a one of the data table field and using inside my stored procedure. I'm sure that there is no issue on my stored procedure. It is working perfectly when I design the report (means that when I set stored procedure to report via design wizard).
As I mentioned, I'm getting this error message when I generate report via report viewer and as well as preview window (please see the attached images below).
Please looking forward your help to solve this issue.
Thanks!
Finally, I managed to understand the problem. The reason is because of 'temporary table. I have temporary table inside my stored procedure and return data from temporary table.
Please refer this link: http://www.telerik.com/forums/temporary-table-in-stored-proc
Hope this helps others!
I was given a report today with a normal embedded data set (dataset1) and data source (datasource1) but the data set query is just a number: '1411'. The previous programer manually entered fields (not calculated fields) into the field tab.
When I click RUN, it works.
How is it populating the page without a proper query?
-There is only 1 tablix called (table1.) It also is pointing to dataset1.
-In Report Properties there is no VB code.
-RDL XML: Under dataset1's tag:
<DataSourceName>datasource1</DataSourceName>
<CommandText>=1411</CommandText>
I see no other SQL listed. Could there be something else on the server that's triggering it?
What sort of data source is "datasource1"?
If it's an RDBMS, check if there is a stored procedure or function in the database with the name "1411".
In SQL Server for example you could conceivably have a stored procedure called [1411] that returned a data set.
I'm assuming we are talking RDL (Report Definition Language). You might open this report with your favorite text editor and look at the CommandText XML tag to find the associated query. Hope that helps.
I have the following scenario:
My website db has a system table called "Companies", which includes an id field, companyName field, and companyImageUrl field.
How do I set up an umbraco document type for adding entries to this table ?
Maybe I shouldn't use a custom table at all ?
Thanks.
As far as I know, Umbraco doesn't support what you want to do out of the box (mapping a document type to a table that isn't part of the umbraco core).
One approach that might work is to create an action handler that syncs a Company doc type to your table when creating a node of that type.
It's a bit of a hack though. I've found that I've very rarely needed to create custom tables. What exactly are you trying to do with it? My guess is that you don't really need it and would be better off working with a doc type instead. Umbraco provides a variety of ways to get and act upon doc types from within custom C# code (check out the umbraco.NodeFactory namespace). You'll also get the added benefit of being able to easily interact with these nodes from XSLT/Razor.
Is it possible to add properties to my model that dont exist in the database?
For example I have a calendar table, I want to retireve this data in my MVC controller then work out time left until each entry starts and return this to the view. So I would like another property in my calendar model to hold time left which is a value that I will generate outside of the database.
I've tried just adding the property but when I do that I get errors because the property is not mapped to anything.
Is this even possible?
Thanks
You should be able to add the property to the Model but you will not be able to query it with LINQ. LINQ will ultimately build and expression which it will want to run against the database using SQL. Its at that point that your LINQ will fail to find a mapping from your property to a field somewhere.
If your query returns an IEnumerable of the actual type on which you have created the property your view may be able to access it. I can't remember if EF insists on mapping in that case, it may do.
You might find that you can create subsequent LINQ query that uses LINQ-to-objects if you want to provide some other composite type to your view.
It's a non-persistent property or transient. I don't know Entity Framwork well but with a quick google search you should find the answer.
BTW you can find a lot of tips here :
http://weblogs.asp.net/zeeshanhirani/archive/2008/12/18/my-christmas-present-to-the-entity-framework-community.aspx
After making a quick search myself and a test in VS2008 I don't see a way to exclude a property from the mapping. Maybe it requires you to edit manually the mapping file ? :(