I have 2 tables in an Access Database. (SQL examples are fine).
The first table is a table called Reports.
The fields are :-
ID
ReportName
ReportType
The second table is a Template, where a user will store a host of reports. The user modifies this template table each week. Below are the fields :-
ID
UserID
ReportName
ReportType
ScheduledDate
Completed
AssignedBy
I have everything in my code working, but I overlooked something vital.
I need to reflect the changes a user may make to the Report Table, I.E, EDIT a reports name, into the Template Table, so that any instance of the edited report, now shows the new name.
I'm struggling to work out how I can do this?
Any help would be appreciated, it doesn't have to be exact code, more so the method.
Only works for .adp project, you should be able to do this using a trigger.
something like
create <trigger_name>
ON Report
....
Related
I'm using C# and Entity Framework.
I created the dataset to display data from it:
With only one table(buildings), i created my crystal report very well.
But now, i want to create another one that display:
name_b, Adresse_b,date
the number of appartements of a building
the number of shared_areas of a building
and the name of the user.
I have to write a query in the crystalReportViewer1_Load and set it as datasource or what?
Thank you to help me.
There are a few options -
1. In your current report, group the report by Building, then
create a sub-report containing all of the details (name,
address,etc) and place it into the group footer in the main (outer)
report. Link the report by ID_Building. This will show you all of
the details for each building.
2. In you current report, add all of the tables to the data connection (database expert); then group the report as desired (by building, Apartment, etc).
You can create running totals to get the count of apartments and the number of shared_areas.
I am creating a desktop, C# application in Lightswitch. I have a DB file with a table called Reports and another table called StatusList. There are going to be 3 options in StatusList table - Unresolved, In Progress and Resolved. The Report table has a couple of not important fields and a field "Status", which is supposed to hold one of the three values from StatusList table
Now, when the user will create a new Report, I need the application to automatically insert the "Unresolved" value as the "Status" without user being able to change it.
I have tried using this method
partial void Reports_Created()
{
this.Status = "Unresolved";
}
but it is not working. I guess it is because I am trying to assign a String value to the field which is populated from another table.
I am using Visual Studio 2013 and this is my first Lightswitch app as well.
Thank you in advance for any help.
It sounds like your trying to pass parameters between screens. Beth Massi does a good job explaining how to achieve that in this video. And here is another MSDN link to a similar question
Shouldn't your code before like:
This.report.status = "Unresolved"
I.e. The report entity is not referenced by "this" (that refers to the screen).
I need to show data on crystal report, my tables are as below
ClientServiceMaster (ServiceNo, ComplainDate, AttainDate, Counter)
ServiceDetail(ServiceNo, Problem, Reason, Action)
ReplacementDetail (ServiceNo, ItemNo, Qty)
Here ClientServiceMaster Data is only once, so I have kept that in Page Header
But there would be more then one records for ServiceDetail as well as ReplacementDetail, I want to show each rows of these both tables.
Kindly Help me in which section I need to add these tables and how to write code
Khilen
You should use sub reports.
You can use separate queries with datasets with the relevant data.
Here are some samples.. Hope you'll find something...
http://csharp.net-informations.com/crystal-reports/csharp-crystal-reports-subreports.htm
http://www.dotnetspider.com/resources/43691-How-create-sub-reports-crystal-report.aspx
I have metadata in a DB table that i want to use in code.
The metadata is different sorts of Time types for reporting spent time.
The data can be:
NormalTime
OverTime
Vacation
Illness
etc
The data have a ID and a description and some other stuff.
ID = 1
Name = "Regular time"
Description = "Normal work time"
What is a good way to relate to this data in my code?
If for example i want create a method that sums all the NormalTime reported (i have another table that stores used time where the NormalTime ID and amount and some other stuff) how do i do that?
I dont want to hardcode the ID:
Select * from xyz where TimeType = 1
What i wanna do is:
Select * from xyz where TimeType = NormalTime.
Otherwise the code becomes very hard to read.
In my current solution i have hardcoded string consts that correlates to the ID.
The problem with this is if someone changes the description of the TimeType from NormalTime to something eles the hardcoded string const sais one thing and the db data sais something else.
And yes, this has happend as i dont have control over the DB content :(
So, how do I solve this in the best maintainable and readable way where changes can occur in the DB table and the code dont get very hard to read.
Where someone can add TimeTypes to the DB and later I can add methods that uses them in code.
One way to do this would be to use Visual Studio's T4 text generation templates.
(Entity Framework uses these for its code generation)
You can create a template file which contains code to pull the tables with metadata
from the database, and generates classes with static constants in.
They do need to be run whenever the database changes, though. But I think you might be able
to set them up so they do re-generate every time your code is built.
A question about T4 templates
You could have an enum type on the C# side that maps to a table in the database.
http://www.codeproject.com/Articles/41746/Mapping-NET-Enumerations-to-the-Database
Im trying to create a report in SSRS. The report calls a stored procedure for its data. I want to display the data in a table.
But the thing is, the result from the stored procedure differs from time to time, because every customer has its own 'template'. This means the result for customer A could be :
AccountNumber | CustomerID
1234567890 0987654321
1579086421 1234565465
...................... ....................
and for customer B could be:
CustomerName | Address
Customer B Teststreet 1
Customer Test Teststreet 2
...................... ....................
There are 50 different columns to choose from. The order of the columns is also editable. My stored procedure takes care of this. The only thing I want is to put the resultset of the storedprocedure 1:1 in my report (header+body). Do you guys know how to do this?
If thats not possible, is there a C# solution to this? I.e creating a report object in C#, adjust settings etc.
Thanks
You can create the SSRS report dynamically based on the data set returned by the stored procedure. The report format (RDL) is documented and its an XML format. So you can use System.XML namespace to generate RDL. Alternate (and unsupported) way is to refer RDL object model assembly (Microsoft.ReportingServices.RdlObjectModel) - you can locate the assembly on SSRS 2008 server machine and copy it on your local machine. It offers an object model to read/generate RDL.
I have adopted approach where RDL is generated (as XML) dynamically based on the data-table and then publish the RDL on SSRS server using web services API.
One solution might be to modify your SP so that the data returned looks something like:
ColNameA DataA ColNameB DataB
AccountNumber, 1234567890, CustomerID, 948477586
AccountNumber, 5466584426, CustomerID, 458852244
Then, in SSRS drag out a table. Create a group on ColNameA. In that Group Row, place the Field ColNameA in the first Column, place ColNameB in the second column.
In the Details Row, place DataA in the first column, and DataB in the second column, and should look like this:
The sample query i used was:
select 'AccountNumber' as ColNameA, 1234567890 as DataA, 'CustomerID' as ColNameB, 0987654321 as DataB UNION
select 'AccountNumber' as ColNameA, 5546488393 as DataA, 'CustomerID' as ColNameB, 4747599393 as DataB
Getting the names of the Columns (AccountNumber, CustomerID or CustomerName, CustomerAddress) will be the key. You can get them via:
select * from INFORMATION_SCHEMA.COLUMNS where TABLE_NAME = 'my_table_name'
You can use the Rdlobjectmodel provided by the Report designer to create and alter a report.
You can reference the Microsoft.ReportingServices.Designer.Controls in to your project but that includes all the dependencies as well which is 20+ assembly or you can copy the following set of DLLs in a separate folder at your project root level and use it to reference the DLLs
Microsoft.ReportingServices.QueryDesigners
Microsoft.ReportingServices.Designer.Controls
Microsoft.ReportingServices.RdlObjectModel
Microsoft.ReportingServices.ReportDesign.Common
Microsoft.ReportingServices.RichText
Microsoft.ReportingServices.RPLObjectModel
private Report LoadReportTemplate()
{
const string docPath = "template.rdl";//path for your template report
using (var fs = new FileStream(docPath, FileMode.Open))
{
var report = Report.Load(fs);
return report;
}
}
Follow the link for Documentation