Showing posts with label generate. Show all posts
Showing posts with label generate. Show all posts

Friday, March 9, 2012

Programmatically generating a reporting model?

Is there documentation/examples on how to programmatically generate a report model (.smdl XML file)? The situation I'm in would make generating the model manually via Visual Studios difficult (would have to hire lots of people).

Any ideas or suggestions would be greatly appreciated.

One option is to download the XSD here and generate an object model from it:

http://schemas.microsoft.com/sqlserver/2004/10/semanticmodeling/SemanticModeling.xsd

Wednesday, March 7, 2012

Programmatically create a Report Model

Hello,

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!

Sandip.

I am not positive but I don't think that the CreateModel method is for what you think it is for. I think it is for creating an instance of the model, uploading it to a ReportServer. IOW you read in an SMDL file and push it to a server, update it -- various management purposes.

Or I could be looking at a different part of the RS API than you are, and you could be right <s>.

IAC, fond as I am of reading schemas and creating XML files from scratch, this one is tough because of all the guids. Probably your best bet would be to start with a basic one and add nodes into it based on the privileges and configuration for an individual install or user, for example adjust the data sources or adding some fields.

>L<

|||

How can I update report models in the report server programmatically?

I was able to publish report models from one server to another using .rss file. I used the method ".createmodel". However, this doesn't have the overwrite parameter unlike ".createreport" method.

Is there a way or command to do this?

Any help would be greatly appreciated(",). Thanks.|||

To start with, I should say that I'm not clear enough about models to understand why you think there are associated parameters. I don't understand the connection, I'm not that familiar with models and didn't think they had parameters.

IAC, yes there is some scripting associated with models and the best advice I can give you is to become familiar with the scripting utilitiy you'll find here: http://www.sqldbatips.com/showarticle.asp?ID=62 It will interrogate your reporting services server and generate scripts for you (including models). And you will learn a lot from what it shows. There is an example of the script it generates here: http://www.sqldbatips.com/samples/code/RSScripter/readme.htm#_script_model

>L<

|||

Lisa,

Thanks. Actually, I was able to find the answer on the same site you've given me( http://www.sqldbatips.com/showarticle.asp?ID=62 ) ...

I downloaded the scripter, run rsscripter.exe, on the scripting options>data/model, i checked update existing model and generate the script. On the generated script, I noticed that they have used .SetModelDefinition method to do this. So, to sum up:

.SetModelDefinition - used to update report models in the report server

.CreateReport - used to create/add report models in the report server

Thanks again

Saturday, February 25, 2012

Programatically query database and save report in an excel table

Hello All,

I am working on constructing a software layer around some features of the RDL language that would allow me to programatically generate reports.

I am reading the RDL specification language, and I do not understand three things:

1) How the DataSet element is populated by the query or more precisely how do the <Field> elements capture all the rows inside the table that is being queries?

To my understanding I wilkl have to define several fields that correspond to all columns of interest in the query.

But that is only for one row (?!) How do the rest of the rows get populated? Does the server recursively create new rows based on my definitions until it matches row for row all the data in the table?

2) Once the elements are inside a DataSet how do make use of that data to render it in a table.

I understand how the DataSource, DataSet, and Table work individually, yet I do not understand how to establish a flow of data between DataSet and Table.

3) Do I even need to use a <Table> as an RDL element in order to organize the data in an excel table?

I would appreciate any help. Thank you!

Anyone?

Monday, February 20, 2012

Programatically Creating Report In PDF Format

My users have a lot of reports that they need to generate and save in PDF
format. Each report is the same, except using different parameters.
What I'd like to do is programatically generate a bunch of PDF report files
to a folder on the network, each one using just a different set of parameters.
I have successfully generated a report using the URL:
http://localhost/reportserver?/Profit%20And%20Loss%20Report&Company=0&JobCode=757375&CustomerGroup=&rs:Command=Render&rs:Format=PDF&rc:OutputFormat=PDF
This pops up a Save As... dialog box, prompting the user for a path and
file name. I'd like to control and set the path file name programatically to
automatically generate all the report permutations by passing different
parameters.
Is the URL method the right approach? Any advice would be appreciated, or at
least point me in the right direction so I can research the actual mechanics
of doing this.
Thanks!!!I think what you want can be accomplished using the Subscription feature of
Reporting Services. You can specify a subscription with the "Report Server
File Share" delivery method in order to save PDFs to a folder on the network
on a specified schedule. You can also set up a shared schedule so all the
subscriptions run at the same time.
- Byron
"Smit-Dog" wrote:
> My users have a lot of reports that they need to generate and save in PDF
> format. Each report is the same, except using different parameters.
> What I'd like to do is programatically generate a bunch of PDF report files
> to a folder on the network, each one using just a different set of parameters.
> I have successfully generated a report using the URL:
> http://localhost/reportserver?/Profit%20And%20Loss%20Report&Company=0&JobCode=757375&CustomerGroup=&rs:Command=Render&rs:Format=PDF&rc:OutputFormat=PDF
> This pops up a Save As... dialog box, prompting the user for a path and
> file name. I'd like to control and set the path file name programatically to
> automatically generate all the report permutations by passing different
> parameters.
> Is the URL method the right approach? Any advice would be appreciated, or at
> least point me in the right direction so I can research the actual mechanics
> of doing this.
> Thanks!!!|||Thanks for the reply Bryon.
The only problem with setup up report subscriptions is that there are about
5 different parameters for the report, and basically I need to cycle through
dozens and dozens of possible parameter values for each parameter. And the
values are database driven, so they will change over time.
I'd like to programatically query the database for a list of valid parameter
values, then loop through the parameters list and generate all the PDF
reports with the proper syntax.
I'm guessing that I can do this from VB or .NET by accessing the SRS web
service interface. I just can't seem to find or understand the documentation
for doing this. Any example code would be great.
Thanks...
"Byron" wrote:
> I think what you want can be accomplished using the Subscription feature of
> Reporting Services. You can specify a subscription with the "Report Server
> File Share" delivery method in order to save PDFs to a folder on the network
> on a specified schedule. You can also set up a shared schedule so all the
> subscriptions run at the same time.
> - Byron
> "Smit-Dog" wrote:
> > My users have a lot of reports that they need to generate and save in PDF
> > format. Each report is the same, except using different parameters.
> >
> > What I'd like to do is programatically generate a bunch of PDF report files
> > to a folder on the network, each one using just a different set of parameters.
> >
> > I have successfully generated a report using the URL:
> >
> > http://localhost/reportserver?/Profit%20And%20Loss%20Report&Company=0&JobCode=757375&CustomerGroup=&rs:Command=Render&rs:Format=PDF&rc:OutputFormat=PDF
> >
> > This pops up a Save As... dialog box, prompting the user for a path and
> > file name. I'd like to control and set the path file name programatically to
> > automatically generate all the report permutations by passing different
> > parameters.
> >
> > Is the URL method the right approach? Any advice would be appreciated, or at
> > least point me in the right direction so I can research the actual mechanics
> > of doing this.
> >
> > Thanks!!!|||programmatically...
you mean something like this? I think this is right.
warnings = rs.CreateReport(asReportName, "/", True,
reportDefinition, Nothing)
If Not (warnings Is Nothing) Then
Dim warning As ReportService.Warning
For Each warning In warnings
lblMsg.Text = warning.Message
Next warning
Else
lblMsg.Text = "Report: {0} created successfully with no
warnings"
End If
result = rs.Render(reportName, "PDF", historyID, devInfo,
parameters, credentials, showHideToggle, encoding, mimeType,
reportHistoryParameters, warnings, streamIDs)
sh.SessionId = rs.SessionHeaderValue.SessionId
lblMsg.Text = "SessionID after call to Render: {0}" &
rs.SessionHeaderValue.SessionId
lblMsg.Text = "Execution date and time: {0}" &
rs.SessionHeaderValue.ExecutionDateTime
lblMsg.Text = "Is new execution: {0}" &
rs.SessionHeaderValue.IsNewExecution
' Write the contents of the report to an pdf file.
Try
' Dim stream As FileStream = File.Create("C:\" &
asReportName & ".pdf", result.Length)
Console.WriteLine("File created.")
stream.Write(result, 0, result.Length)
Console.WriteLine("Result written to the file.")
stream.Close()
Catch ex As Exception
lblMsg.Text = ex.Message
GoTo Exit_Sub
End Try
--
Message posted via http://www.sqlmonster.com