Programmatically Determine That A Report Has No Data?
Apr 2, 2008
I'm creating ssrs reports via the web service render method & would like to be able to determine when a report has no data.
Currently what I'm doing is rendering the report twice - once as a pdf (the format that the report needs to be in) and once as a csv. I then check the csv for a specific string placed in the norows property of the report table.
Is there a better way of doing this? It seems to me that this would have been a good candidate to include in the warnings array.
Between this issue & the hacks required to get data into the header I'm thinking that I should maybe reconsider some other reporting options...
I have a system that processes inserts that originate from automatic data collection subsystems on manufacuturing cells. The system processes about 2500 records a day. The system is isolated with no ready support or attention. My goal is to automate any and every reasonable admin task. My present activity centers on re-indexing the main table (receives the data from the inserts, supplies the data for web based reporting).
The table - tb_production_log - receives inserts that are time stamped and bear a Machine_id. The table has a clustered index built on the Machine_id (int) and Date_time (time of data's acquisition). The table only receives Inserts, the records are never Updated. No inserts are out of time sequence (no older records ever have to be 'wedged' in amongst existing records). Ulitmately, the table is tested daily for records with age > 365 days. Such records are Deleted.
For the past week, I have been running a monitoring stored procedure on my test box to track the fragmentation of the tb_production_log table. It's based on DBCC SHOWCONTIG with some extra tests. After capturing the SHOWCONTIG data, the sp runs a test query against the table to emulate a typical User report. I track the time this query takes. The query covers records over the last 7 days. (approx. 17,500 records involved). In addition, I track the time it takes Inserts to run. Inserts are done in batches from an external app. I get a RecordsPerSecond data point for each batch.
I have a system that processes inserts that originate from automatic data collection subsystems on manufacuturing cells. The system processes about 2500 records a day. The system is isolated with no ready support or attention. My goal is to automate any and every reasonable admin task. My present activity centers on re-indexing the main table (receives the data from the inserts, supplies the data for web based reporting).
The table - tb_production_log - receives inserts that are time stamped and bear a Machine_id. The table has a clustered index built on the Machine_id (int) and Date_time (time of data's acquisition). The table only receives Inserts, the records are never Updated. No inserts are out of time sequence (no older records ever have to be 'wedged' in amongst existing records). Ulitmately, the table is tested daily for records with age > 365 days. Such records are Deleted.
For the past week, I have been running a monitoring stored procedure on my test box to track the fragmentation of the tb_production_log table. It's based on DBCC SHOWCONTIG with some extra tests. After capturing the SHOWCONTIG data, the sp runs a test query against the table to emulate a typical User report. I track the time this query takes. The query covers records over the last 7 days. (approx. 17,500 records involved). In addition, I track the time it takes Inserts to run. Inserts are done in batches from an external app. I get a RecordsPerSecond data point for each batch.
I wrote a custom IIS log reader windows service that reads and parses log data and periodically uploads it to a SQL server table which I run my reports from later. Currently I read the file by giving the absolute physical path name for the log directory followed by the log file name I anticipate depending on date/time stamps.
My question is: Is there a programmatic way to get the directory path which is configured in IIS to store the IIS log files to? We use non default location e.g. D:DATALOGSIISW3SVC1 or something similar, which might change from server to server. Also, I am not worried about the individual log file names but the directory. I would prefer a C# code example.
All, if I were to write an app that has one task, determine whether ornot an SQL Instance is running, what would be the easist method forthis? I personally think that a query against the masterdb would dothe trick. I would appreciate any feedback you can provide.L
I've been working on an application that uploads an RDL to Reporting Services (through the SOAP webservice method CreateReport) programmatically. I'm having difficulty setting up the data source properties for my uploaded report. In particular the Data Source Credentials property.
The datasource for my report doesn't require credentials. By default after I upload the report to Reporting Services, the Data Source Credentials property is set to "Credentials supplied by the user running the report". How do I go about setting the Data Source Credentials property to "Credentials are not required" programmatically through the webservice?
HI everyone; i have a problem , is there a possible to pass a dataset to a ssrs report programmatically ? or at runtime without specifying it at design time ...
What we'd like to do is programmatically generate and maintain a report model based on how the individual install is configured. I've found some documentation that makes me believe this is possible, but I'm hoping someone can nudge me in the right direction. The ReportingServices2005 class has several model related methods (CreateModel) and I found the .xsd for the semantic model XML file (http://schemas.microsoft.com/sqlserver/2004/10/semanticmodeling/SemanticModeling.xsd), but no real documentation on how to put together a Report Model document from scratch. Looking at the files generated from BIDS is somewhat overwhelming and I have no idea where I'd pull most of the information.
Finally, I want to create Report Model(.smdl) file without Report Model Designer.
I want to Implement CreateModel Method to create new model, any source code sample..??
Any help that can be provided would be greatly appreciated. Thanks!
I want to add some customized text to the report programmatically before the report is rendered. As it has to be done for all the reports, I don't want to do it report by report. For example, the report needs to display user selected filters. Any thoughts?
I'm working on custom report manager. It manages "report entities" and "report templates" (actually, RDLs uploaded on the server) and stores one-to-many relation between them. The task is to store "MasterEntityID" report parameter in every RDL and keep it up in actual state whether RDL is being assigned to another entity or new RDL is being uploaded and assigned. I've covered the first issue with SetReportParameters() web method, but how should I deal with the second one? Uploaded RDL may be short of the param, so I have to add it programmatically while uploading.
I am struggling to programmatically render my report to a pdf without displaying it in a viewer and would appreciate a pointer in the right direction.
My code seems to work and the report is found and everything is honkey-dorey until I try to actually load the report.. lemme show: (please excuse the bit of a mess since this is just a test form)
// Authenticate to the Web service using Windows credentials rs.Credentials = System.Net.CredentialCache.DefaultCredentials; rsExec.Credentials = System.Net.CredentialCache.DefaultCredentials;
FindReport(); //Create a variable containing the selected item selItem = MyCatalogItem.Item; try { // Get if any parameters needed. _parameters = rs.GetReportParameters(selItem.Path , _historyID, _forRendering, _values, _credentials );
// Load the selected report. rsExecService.ExecutionInfo ei = rsExec.LoadReport(selItem.Path, historyID);
// Prepare report parameter. // Set the parameters for the report needed. rsExecService.ParameterValue[] parameters = new rsExecService.ParameterValue[5];
// Place to include the parameter.. if (_parameters.Length > 0) { parameters[0] = new rsExecService.ParameterValue(); parameters[0].Value = pQuoteID.ToString(); parameters[0].Label = "Quote ID"; parameters[0].Name = "cor_Quote_id";
} rsExec.SetExecutionParameters(parameters, "en-us"); results = rsExec.Render(format, deviceInfo, out mimeType, out encoding, out warnings, out streamIDs);
// Create a file stream and write the report to it using (FileStream stream = File.OpenWrite(fileName)) { stream.Write(results, 0, results.Length); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
Right, It bombs out at the section I marked in blue and gives me this HUGE message :
"System.Web.Services.Protocols.SoapException: Server did not recognize the value of HTTP Header SOAPAction: http://schemas.microsoft.com/sqlserver/2005/01/12/reporting/reportingservices/LoadReport. at System.Web.Services.Protocols.Soap11ServerProtocolHelper.RouteRequest() at System.Web.Services.Protocols.SoapServerProtocol.RouteRequest(SoapServerMessage message) at System.Web.Services.Protocols.SoapServerProtocol.Initialize() at System.Web.Services.Protocols.ServerProtocolFactory.Create(Type type, HttpContext context, HttpRequest request, HttpResponse response, Boolean& abortProcessing)"
Could this be related to credentials or something? Any advice welcome. Thanks Mates
I am facing some issues while creating report snapshots programmatically using axis (Java platform for creating and deploying web services applications).
To create a report snapshot what should be the methods called ? I tried using UpdateReportExecutionSnapshot() but didn't find any parameters to set the schedule information which would say when the execute the report snapshot. Can you please guide me for this ?
Also I had one more doubt regarding report snapshots. If a parameterized report is configured as snapshot then we would require to set default parameters for the report.
Is there a way to create snapshots of the same report with different parameters ?
eg : The employee information report displays the information based on the employee id taken as a parameter. So is it possible to create snapshots with different employee id's ?
How can we programmatically cause a Manual Report History Snapshot to be created.
I know it can be done using the Webservice. How would we do it using the ReportServer stored procedures. Which SP/SP's can we call. With what parameters.
I have located the Server where Reporting Services has been installed and I believe I have found the Report Server Database. Is there any way from the Report Server Tables that I can try and figure out where the Report Manager URL might be?
my problem is , i want to deploy my rdl and rds file which i make in the sql 2005 reporting services. Now i want to deploy this rdl through asp.net coding using language VB i hope someone is help me Thanks Rahul Sinha
I have created many shared datsources and reprots at http://localhost/resportserver.
I am trying to access these reports from ReportViewer in the web application. Actually I want to use these reports for different customers by just changing the datsource programitically.
I am working on complex invoice document that handles various types of invoicing, credit, and progress bill customer facing documents. Â I am faced with same problem I see many SSRS devs posting on. Â And that is extra blank pages, being generated because the report width exceeds the width of the page.
My problem is I cannot shrink the horizontal width of the tablix and therefore the report width either...
While I would have done things differently if developing from scratch, the tablix in question has only one column and objects contained in rectangles are placed in the row/column cell.....The link to the image below shows the row I am currently working on. Â Essentially all the client wants a columnar report with column lines, closed footers, etc... Â so rather redoing the whole tablix, which I still might do, I am using rectangles with the column then lining them up. Â Anyway, that is a whole 'nuther post. Â My specific questions are: Â
Invoice in Report Builder
1. In the image I have selected the parent rectangle. Â The children are other rectangles and the data is with grandchildren textboxes that exist within those rectangles. Â I clearly have a bit of right side white space in the main parent rectangle, but there is no sizing tool on a hover... just move tool. Â And if I change the rectangle size in the prop form it just snaps back to the cell width. Â How do I size the parent rectangle and keep if from expanding.
Here I am guessing that to actually reduce the horizontal width of tablix and then the report, I have to first decrease the parent width of the rectangles that occur in each row?
I have a requirement based on 2 parts to determine a row of data in a table through SSIS :
a. Work out the LEG_SEQ_NBR of the VESSEL, VOYAGE and LEG already stored in table1.
To do this join table1 and join table2 through BL_ID column.
b. Work out the 2ndVESSEL, 2ndVOYAGE and 2ndLEG.
Once we have identified the LEG_SEQ_NBR of the VESSEL,VOYAGE, LEG already stored in table1 we need to add '1' to this value and then find that LEQ_SEQ_NBR in table2.
The DDL of table1 and table2 along with the test data are as below:
ello all Would someone be so kind as to save me from getting balder through pulling my hair out. My aim is to extract data from a database using SQLDataSource, then edit the data and update the database using the SQLDataSource. I have achieve the problem of retrieving the data from the sqlDataSource:DataView openRemindingSeats = (DataView)SqlDataSource2.Select(DataSourceSelectArguments.Empty); //Int32 openRemindingSeats = SqlDataSource2.Select(DataSourceSelectArguments.Empty), DataView; foreach (DataRowView rowProduct in openReminding) { //Output the name and price lbl_NumOfSeatsLeft.Text = rowProduct["Remaining"].ToString(); } Within the sqlDataSource the sql code is as follows:SELECT [refNumber], [refRemaining] FROM [refFlights] WHERE ([refNumber] = @Number) So at the moment my problems is being able to edit and update data to the same SELECTed data.Thank you for any help that you might have... SynDrome
Our reporting group would like to generate reports based on day of the week. Is there a function or other means of determining the day based on data in a datetime field? Thanks for any assistance in advance.
Does anyone know how to determine the base datatype of a column? I've tried using sp_columns but if there are user defined datatypes on the column it returns that name instead of the base datatype. I've also tries accessing systypes and syscolumns to determine the base datatypes.
I just want to insert a record into a table using a SqlDataSource control. But I'm having a hard time finding examples that don't use data bound controlsI have this so far (I deleted the parts not related to the insert):<asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:UserPolls %>" InsertCommand="INSERT INTO [PollAnswers] ([PollId], [AnswerText], [AnswerCount]) VALUES (@PollId, @AnswerText, @AnswerCount)" <InsertParameters> <asp:Parameter Name="PollId" Type="Int32" /> <asp:Parameter Name="AnswerText" Type="String" /> <asp:Parameter Name="AnswerCount" Type="Int32" /> </InsertParameters> </asp:SqlDataSource> This is the data source for a gridview control I have on the page. I could set up an SqlDataSource for this alone if I need to, but i don't know if it would help. From what I could find, in the code behind I should haveSqlDataSource2.Insert()and SqlDataSource2 will grab the parameters and insert the record. The problem is I need to set the Pollid (from a session variable) and AnswerText (from a text box) at run time. Can I do this?Diane
Hi I think I've programmatically created a SqlDataSource - which is what I want to do; but I can't seem to access details from the source - row 1, column 1, for example???? If Not Page.IsPostBack Then 'Start by determining the connection string valueDim connString As New Data.SqlClient.SqlConnection(ConfigurationManager.ConnectionStrings("ConnectionString").ConnectionString) 'Create a SqlConnection instanceUsing connString 'Specify the SQL query Const sql As String = "SELECT eventID FROM viewEvents WHERE eventID=17" 'Create a SqlCommand instanceDim myCommand As New Data.SqlClient.SqlCommand(sql, connString) 'Get back a DataSetDim myDataSet As New Data.DataSet 'Create a SqlDataAdapter instanceDim myAdapter As New Data.SqlClient.SqlDataAdapter(myCommand) myAdapter.Fill(myDataSet)Label1.Text = myAdapter.Tables.Rows(0).Item("eventID").ToString() -?????????????? 'Close the connection connString.Close() End Using End IfThanks for any helpRichard
I have a web application I created in asp.net + sql2005 and am deploying a genercized version of it to multiple clients. I have created a script which dynamically generates a database to a server and creates all of the tables, procs, and views. I now need data from the old database, which will be imported into the new database. It's basically default users, lookup values, etc. What are some methods of getting this data out of the old server and into the new server? I was thinking about generating flat files with the data, then writing code to loop through and insert the data, but it seems very tedious. Do I have any other options? I cannot use Backup and Restore because I have no access to the new sql server's filesystem.Thanks.
Hey all, I have a profile table for members of a website that allows them to upload an avatar for use throughout the site. I decided to add the option to just remove the avatar if they want to no longer use one at all and I am stuck. I am running an update statement against thier entire profile incase they change more then just removing thier avatar but of course when I try this statement. myCommand.Parameters.AddWithValue("@avatar", "") I get a conversion error, which makes sence. So what instead of "" do I need for code to just insert empty data to overwirte thier current avatar data. Any help would be great, thanks for you time.
Hey all, Another varbinary question. I am trying to move an image stored in a table varbinary(max) directly from one table to another programmatically. The rest of the data is just nvarchar(50) so I just use a T-SQL select statement in the code behind and feed all of the date into an SqlDataReader, I do this becuse there is some user interaction when the data is moved, so there may be some new values updated when transfering from one table to another, so once the old and possibly new data is stored in seperate variables then I use a T-SQL insert statement to move all of the data into the other table. Problem is I am not really sure how to handle the image data(varbinary(max)) to just do a straight up transfer from the one table to another. I get conversion errors when trying to handle the data as a string which makes sense. Not sure what to put for code examples since I really am stumped with this, but here is what is not working. Dim imageX As String SqlDataReader Code - imageX = reader("imageData") Insert code - myCommand.Parameters.AddWithValue("@imageData", imageX) Thanks in advance,
I have created a package which simply imports data from a flat file to a SQL Server table. But I need to incorporate a data conversion component by which I may change the source-destination column mapping programmatically. So what I thought that I need to add a data conversion component into the dataflow task. After adding this component (I found its component id as {C3BF62C8-7C5C-4F85-83C3-E0B6F6BE267C}) I have created a path which establishes the mapping between output columns of source component and the input columns of data conversion component. Now I am not sure how to establish the mapping between the data conversion component€™s input column collection and output column collection.
I am giving my code snippet here, IDTSComponentMetaData90 sourceDataFlowComponent = dataFlowTask.ComponentMetaDataCollection.New(); sourceDataFlowComponent.ComponentClassID = "{90C7770B-DE7C-435E-880E-E718C92C0573}"; €¦ €¦ €¦. // Code for configuring the source data flow component
IDTSComponentMetaData90 conversionDataFlowComponent = dataFlowTask.ComponentMetaDataCollection.New();// creating data conversion conversionDataFlowComponent.ComponentClassID = "{C3BF62C8-7C5C-4F85-83C3-E0B6F6BE267C}";// This is the GUID for data conversion component CManagedComponentWrapper conversionInstance = conversionDataFlowComponent.Instantiate();//Instantiate conversionInstance.ProvideComponentProperties(); // Now creating a path to connet the source and conversion IDTSPath90 fPath = dataFlowTask.PathCollection.New(); fPath.AttachPathAndPropagateNotifications( sourceDataFlowComponent.OutputCollection[0], conversionDataFlowComponent.InputCollection[0]); // Sould I need to accuire connect for data conversion? Im not sure conversionInstance.AcquireConnections(null); conversionInstance.ReinitializeMetaData(); // Get the input collection IDTSInput90 input = conversionDataFlowComponent.InputCollection[0]; IDTSVirtualInput90 vInput = input.GetVirtualInput(); foreach (IDTSVirtualInputColumn90 vColumn in vInput.VirtualInputColumnCollection){ conversionInstance.SetUsageType( input.ID, vInput, vColumn.LineageID, DTSUsageType.UT_READONLY); }
.. . // Well here I am stucked. What I need to do here to establish a map // between conversionDataFlowComponent.InputCollection[0] and // conversionDataFlowComponent.OutputCollection[0]?
As you can see I am just away from creating the mapping between input and output collection. Can anybody give me an idea how can I achieve this?
I will appreciate all kind of suggestions and comments.
Is it possible to add a Fuzzy Grouping Transformation in a Data flow task by Programmatically ? If it possible, what is the C# or VB .net code for that ?
does anyone know of a good example of how to programmatically add a Data Conversion Transformation to a package? I have come so far that I have the component in my dataflow task, but I don't know how to set the properties of it. That is, how to determine the columns that should be converted and to what data type etc.
I (as far as I understand) need a data conversion transformation since I have not managed to create (via the designer) a package that reads data from an AS400 via DB2OLEDB and stores it in a SQL Server 2005 Database. I keep getting the error "string cannot be converted from unicode to non-unicode" (or something like that) and by searching this forum I learned that the data conversion component might do the trick.
I added this conversion to a manually designed package and it solved the error, but I don't know how to re-create this package programmatically. I would really appreciate some help on this.
Also, if someone has managed to import data from AS400 to SQL server 2005 via OLEDB and NOT got the string conversion error, please let me know!