Showing posts with label ssrs. Show all posts
Showing posts with label ssrs. Show all posts

Monday, March 19, 2012

How to Create a Report in SSRS from Local XML File

Hi

i need to create a Report from XML file which available in my current folder.

can anybody suggest How to create a Data source from XML file and How to make a query for that.

Thanks

Mahesh

Are you doing this in an application with ReportViewer in LocalMode? Or is this going to be a server-side app (where you're just using the XML file in your folder as a test file)?

The way to do it is different, depending on the answer to this first question... but in both cases I will have the followup question:

Is the XML file in a regular, table-like format (like Dataset XML), so that it will be easy to make into a datasource? Or is the schema different altogether?

>L<

|||

Hi thanks for ur reply

now we have chenged the way i need to prepare a report

One web service will return a DataSet

based on that Dataset i need prepare a report.

Thanks

Mahesh

|||

hi Mahesh,

That change doesn't really change anything about my first question, although it answers the second one<g>.

The way you are going to do this is still going to be different depending on whether the report is rendered server-side or client-side. Are you writing a web-application, a win-forms application, or what? Are you using the reportviewer client control?

If you need to send that dataset as a source to a server-side rendering of the report, you are still going to have to send that information as XML to the server. (But that will be easy because the dataset will turn itself into the "right kind" of XML for this purpose.) If you need to do this, we will discuss further.

If you are rendering the report using reportviewer, so you can use local report mode, then you can almost certainly give the localmode report your dataset without any trouble, and without turning it into XML first. In fact, if you *are* using XML, you load it into a dataset to give to the viewer control <s>.

Hope this helps

>L<

|||

Hi Lisa

Thanks for giving more information

I need to prepare a Server side Report .

with sql server 2005 we got One VS 2005 IDE in that i have taken Report Server Project Here am creating my reports.

for this they are given me a webservice link that will return a Data set

based on that i need to prepare a Report.

Previously i know how to prepare a report from Sql server Database.

Thanks.

Mahesh

|||

OK. If the webservice returns a dataset, then it returns it as an XML message. You should be fine with this in a server-side report.

Define the datasource as follows:

The DataSource is of type XML.
The connection string for the web service datasource is in fact the URL for the web service! (http://...) For testing you can put up a local copy of it (http://localhost/test/my.xml) and assign that as your datasource.
The query string, believe it or not, can just be "*". (no quotes) if the XML is a "raw" dataset style. You can also use the (bleh) element query syntax that they've specified -- see here http://technet.microsoft.com/en-us/library/ms365158.aspx -- If you get stuck, post an example of what the web service response message looks like and I'll try to help.|||

Hi

Lisa

i was struck with writing query

i got the webservice responce

<?xml version="1.0" encoding="utf-8" ?>
- <DataSet xmlns="http://tempuri.org/">
- <xsTongue Tiedchema id="NewDataSet" xmlns="" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urnTongue Tiedchemas-microsoft-com:xml-msdata">
- <xs:element name="NewDataSet" msdata:IsDataSet="true" msdata:UseCurrentLocale="true">
- <xs:complexType>
- <xs:choice minOccurs="0" maxOccurs="unbounded">
- <xs:element name="Project">
- <xs:complexType>
- <xsTongue Tiedequence>
<xs:element name="ProjectUID" msdataBig SmileataType="System.Guid, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" type="xsTongue Tiedtring" minOccurs="0" />
<xs:element name="ProjectName" type="xsTongue Tiedtring" minOccurs="0" />
</xsTongue Tiedequence>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
</xs:element>
</xsTongue Tiedchema>
- <diffgrBig Smileiffgram xmlns:msdata="urnTongue Tiedchemas-microsoft-com:xml-msdata" xmlnsBig Smileiffgr="urnTongue Tiedchemas-microsoft-com:xml-diffgram-v1">
- <NewDataSet xmlns="">
- <Project diffgr:id="Project1" msdata:rowOrder="0">
<ProjectUID>8f584354-259b-48fb-a82b-838dd0d75a52</ProjectUID>
<ProjectName>Reports</ProjectName>
</Project>
</NewDataSet>
</diffgrBig Smileiffgram>
</DataSet>

In DataSet dialog Box i have taken a query

first i tried with "*" only it is showing error

an tried with this

<Query>
<SoapAction>
http://tempuri.org/GetAttributes
</SoapAction>
<Method Namespace="http://tempuri.org/"
Name="GetAttributes">
</Method>
</Query>

It is also not displaying the values of ProjectUid and ProjectName.

can u help me how to write the query for this type of WebService Responce.

Thanks

Mahesh

|||

Mahesh, I thought they were sending you a dataset -- is the method GetAttributes the way you are supposed to get that dataset or does it represent a query you are trying to do to get the metadata *describing* the dataset?

Either way... To use the dataset "raw", the thing you are receiving should look like, well, a serialized dataset, like you would get from a dataset if you used its .WriteXML() or .GetXML() methods. You can't use the "*" (I don't think) unless it looks like that. I can't remember what MS blog I read about this in -- it works, but it is only the simplest way.

It is not the only way. Here is a very quick walkthrough that you should find helpful for your scenario: http://blogs.msdn.com/bimusings/archive/2006/03/24/560026.aspx

Here is another walkthrough http://msdn.technetweb3.orcsweb.com/gsnowman/archive/2005/10/12/480321.aspx

And a blog entry that goes through it again http://blogs.msdn.com/bwelcker/archive/2005/11/13/492296.aspx

I think they both show you examples of query syntax.

Here is a tutorial about using XML as a datasource that will help you -- I'm pointing you at lesson 2, where you're learning how the web service is supposed to return the serialized data set but you probably want to look at all the lessons in this tutorial -- http://technet.microsoft.com/en-us/library/aa337489.aspx

Other references describing other aspects that I have found helpful.
http://technet.microsoft.com/en-us/library/aa964129.aspx
http://channel9.msdn.com/ShowPost.aspx?PostID=137650

>L<

How to Create a Report in SSRS from Local XML File

Hi

i need to create a Report from XML file which available in my current folder.

can anybody suggest How to create a Data source from XML file and How to make a query for that.

Thanks

Mahesh

Are you doing this in an application with ReportViewer in LocalMode? Or is this going to be a server-side app (where you're just using the XML file in your folder as a test file)?

The way to do it is different, depending on the answer to this first question... but in both cases I will have the followup question:

Is the XML file in a regular, table-like format (like Dataset XML), so that it will be easy to make into a datasource? Or is the schema different altogether?

>L<

|||

Hi thanks for ur reply

now we have chenged the way i need to prepare a report

One web service will return a DataSet

based on that Dataset i need prepare a report.

Thanks

Mahesh

|||

hi Mahesh,

That change doesn't really change anything about my first question, although it answers the second one<g>.

The way you are going to do this is still going to be different depending on whether the report is rendered server-side or client-side. Are you writing a web-application, a win-forms application, or what? Are you using the reportviewer client control?

If you need to send that dataset as a source to a server-side rendering of the report, you are still going to have to send that information as XML to the server. (But that will be easy because the dataset will turn itself into the "right kind" of XML for this purpose.) If you need to do this, we will discuss further.

If you are rendering the report using reportviewer, so you can use local report mode, then you can almost certainly give the localmode report your dataset without any trouble, and without turning it into XML first. In fact, if you *are* using XML, you load it into a dataset to give to the viewer control <s>.

Hope this helps

>L<

|||

Hi Lisa

Thanks for giving more information

I need to prepare a Server side Report .

with sql server 2005 we got One VS 2005 IDE in that i have taken Report Server Project Here am creating my reports.

for this they are given me a webservice link that will return a Data set

based on that i need to prepare a Report.

Previously i know how to prepare a report from Sql server Database.

Thanks.

Mahesh

|||

OK. If the webservice returns a dataset, then it returns it as an XML message. You should be fine with this in a server-side report.

Define the datasource as follows:

The DataSource is of type XML.
The connection string for the web service datasource is in fact the URL for the web service! (/) For testing you can put up a local copy of it (http://localhost/test/my.xml) and assign that as your datasource.
The query string, believe it or not, can just be "*". (no quotes) if the XML is a "raw" dataset style. You can also use the (bleh) element query syntax that they've specified -- see here http://technet.microsoft.com/en-us/library/ms365158.aspx -- If you get stuck, post an example of what the web service response message looks like and I'll try to help.|||

Hi

Lisa

i was struck with writing query

i got the webservice responce

<?xml version="1.0" encoding="utf-8" ?>
- <DataSet xmlns="http://tempuri.org/">
- <xsTongue Tiedchema id="NewDataSet" xmlns="" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urnTongue Tiedchemas-microsoft-com:xml-msdata">
- <xs:element name="NewDataSet" msdata:IsDataSet="true" msdata:UseCurrentLocale="true">
- <xs:complexType>
- <xs:choice minOccurs="0" maxOccurs="unbounded">
- <xs:element name="Project">
- <xs:complexType>
- <xsTongue Tiedequence>
<xs:element name="ProjectUID" msdataBig SmileataType="System.Guid, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" type="xsTongue Tiedtring" minOccurs="0" />
<xs:element name="ProjectName" type="xsTongue Tiedtring" minOccurs="0" />
</xsTongue Tiedequence>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
</xs:element>
</xsTongue Tiedchema>
- <diffgrBig Smileiffgram xmlns:msdata="urnTongue Tiedchemas-microsoft-com:xml-msdata" xmlnsBig Smileiffgr="urnTongue Tiedchemas-microsoft-com:xml-diffgram-v1">
- <NewDataSet xmlns="">
- <Project diffgr:id="Project1" msdata:rowOrder="0">
<ProjectUID>8f584354-259b-48fb-a82b-838dd0d75a52</ProjectUID>
<ProjectName>Reports</ProjectName>
</Project>
</NewDataSet>
</diffgrBig Smileiffgram>
</DataSet>

In DataSet dialog Box i have taken a query

first i tried with "*" only it is showing error

an tried with this

<Query>
<SoapAction>
http://tempuri.org/GetAttributes
</SoapAction>
<Method Namespace="http://tempuri.org/"
Name="GetAttributes">
</Method>
</Query>

It is also not displaying the values of ProjectUid and ProjectName.

can u help me how to write the query for this type of WebService Responce.

Thanks

Mahesh

|||

Mahesh, I thought they were sending you a dataset -- is the method GetAttributes the way you are supposed to get that dataset or does it represent a query you are trying to do to get the metadata *describing* the dataset?

Either way... To use the dataset "raw", the thing you are receiving should look like, well, a serialized dataset, like you would get from a dataset if you used its .WriteXML() or .GetXML() methods. You can't use the "*" (I don't think) unless it looks like that. I can't remember what MS blog I read about this in -- it works, but it is only the simplest way.

It is not the only way. Here is a very quick walkthrough that you should find helpful for your scenario: http://blogs.msdn.com/bimusings/archive/2006/03/24/560026.aspx

Here is another walkthrough http://msdn.technetweb3.orcsweb.com/gsnowman/archive/2005/10/12/480321.aspx

And a blog entry that goes through it again http://blogs.msdn.com/bwelcker/archive/2005/11/13/492296.aspx

I think they both show you examples of query syntax.

Here is a tutorial about using XML as a datasource that will help you -- I'm pointing you at lesson 2, where you're learning how the web service is supposed to return the serialized data set but you probably want to look at all the lessons in this tutorial -- http://technet.microsoft.com/en-us/library/aa337489.aspx

Other references describing other aspects that I have found helpful.
http://technet.microsoft.com/en-us/library/aa964129.aspx
http://channel9.msdn.com/ShowPost.aspx?PostID=137650

>L<

How to create a percent of variance column in a matrix

I have used SSRS 2005 to create a matrix and need to add a % of variance column. Is this possible? I hope I'm missing something simple. Basically the report should look like this:

Item CurVol PriorVol % of Var CurSales PriorSales % of Var

abc 100 90 11% 1250 990 26%

cde 96 128 -25% 192 243 -21%

Dataset looks this this:

Select item, vol, sales, 'Current' AS Per

FROM Table
WHERE (invoice_date >= @.curStartDate) AND (invoice_date < @.curEndDate + 1)
UNION

Select item, vol, sales, 'Prior' AS Per

FROM Table
WHERE (invoice_date >= @.priorStartDate) AND (invoice_date < @.priorEndDate + 1)

The column group on the matrix is using the Per column because the accounting periods cross over calendar months.

gusina


What is the calculation that you use to get % of variance?|||(Current - Prior) / Prior|||

Item CurVol PriorVol % of Var CurSales PriorSales % of Var

abc 100 90 11% 1250 990 26%

cde 96 128 -25% 192 243 -21%

OK so I am assuming you have the columns for current and prior with the data correct in the matrix. To get your % of Var column, just add a new column to the matrix. For the expression of that column use something like the following:

= (Fields!CurrentVol.Value - Fields!PriorVol.Value) / Fields!Prior.Value

Do similar to the above for Sales.

|||

The matrix for this project is structured with two data fields (Vol and Sales), one row group (item), and one column group (per) with values of Current or Prior. The available fields are Fields!Vol.Value and Fields!Sales.Value. How can the recommended expression be created?

Monday, March 12, 2012

How to create a group on selected report parameters?

Hello,
Using SSRS 2005 SP2, I have a report that has a multivalue parameter of US
states in a report that returns orders.
I successfully can return order numbers along with the associated state
where the order was placed.
However, if I select the states of NH, VT, and MA and there are no orders
from VT, I still need a group header for VT to show that there was no data
for VT. So my thought was to create a report grouping based on the states
selected in the multivalue State parameter. I can't find a way to do this.
Also, I know I could use a subreport to resolve this but it is not an option
here. I need this report to be exported to MS Excel and subreports do not
export to Excel.
Thank you,
JustinOn Oct 3, 3:48 pm, justinsaraceno
<justinsarac...@.discussions.microsoft.com> wrote:
> Hello,
> Using SSRS 2005 SP2, I have a report that has a multivalue parameter of US
> states in a report that returns orders.
> I successfully can return order numbers along with the associated state
> where the order was placed.
> However, if I select the states of NH, VT, and MA and there are no orders
> from VT, I still need a group header for VT to show that there was no data
> for VT. So my thought was to create a report grouping based on the states
> selected in the multivalue State parameter. I can't find a way to do this.
> Also, I know I could use a subreport to resolve this but it is not an option
> here. I need this report to be exported to MS Excel and subreports do not
> export to Excel.
> Thank you,
> Justin
>From your description, you will most likely want to insert dummy rows
in the returned dataset from the stored procedure/query that is
sourcing the report based on the parsing out of the multi-select
parameter. Hope this helps.
Regards,
Enrique Martinez
Sr. Software Consultant|||Thank you Enrique. It's not the answer I wanted to hear but I suppose it's a
possible solution. I wish there was a better way than having to manipulate
my dataset with dummy data. Thank you again.
"EMartinez" wrote:
> On Oct 3, 3:48 pm, justinsaraceno
> <justinsarac...@.discussions.microsoft.com> wrote:
> > Hello,
> > Using SSRS 2005 SP2, I have a report that has a multivalue parameter of US
> > states in a report that returns orders.
> >
> > I successfully can return order numbers along with the associated state
> > where the order was placed.
> >
> > However, if I select the states of NH, VT, and MA and there are no orders
> > from VT, I still need a group header for VT to show that there was no data
> > for VT. So my thought was to create a report grouping based on the states
> > selected in the multivalue State parameter. I can't find a way to do this.
> >
> > Also, I know I could use a subreport to resolve this but it is not an option
> > here. I need this report to be exported to MS Excel and subreports do not
> > export to Excel.
> >
> > Thank you,
> > Justin
>
> >From your description, you will most likely want to insert dummy rows
> in the returned dataset from the stored procedure/query that is
> sourcing the report based on the parsing out of the multi-select
> parameter. Hope this helps.
> Regards,
> Enrique Martinez
> Sr. Software Consultant
>|||Hi,
I have the same problem. Did you find any solution to that?
--
Thanks,
Tabbey
"justinsaraceno" wrote:
> Thank you Enrique. It's not the answer I wanted to hear but I suppose it's a
> possible solution. I wish there was a better way than having to manipulate
> my dataset with dummy data. Thank you again.
> "EMartinez" wrote:
> > On Oct 3, 3:48 pm, justinsaraceno
> > <justinsarac...@.discussions.microsoft.com> wrote:
> > > Hello,
> > > Using SSRS 2005 SP2, I have a report that has a multivalue parameter of US
> > > states in a report that returns orders.
> > >
> > > I successfully can return order numbers along with the associated state
> > > where the order was placed.
> > >
> > > However, if I select the states of NH, VT, and MA and there are no orders
> > > from VT, I still need a group header for VT to show that there was no data
> > > for VT. So my thought was to create a report grouping based on the states
> > > selected in the multivalue State parameter. I can't find a way to do this.
> > >
> > > Also, I know I could use a subreport to resolve this but it is not an option
> > > here. I need this report to be exported to MS Excel and subreports do not
> > > export to Excel.
> > >
> > > Thank you,
> > > Justin
> >
> >
> > >From your description, you will most likely want to insert dummy rows
> > in the returned dataset from the stored procedure/query that is
> > sourcing the report based on the parsing out of the multi-select
> > parameter. Hope this helps.
> >
> > Regards,
> >
> > Enrique Martinez
> > Sr. Software Consultant
> >
> >|||I didn't find anything better than creating some dummy data via something
like a temp table. If SSRS supported export to excel for reports with
subreports, there wouldn't be such a hack to get around this.
"tabbey" wrote:
> Hi,
> I have the same problem. Did you find any solution to that?
> --
> Thanks,
> Tabbey
>
> "justinsaraceno" wrote:
> > Thank you Enrique. It's not the answer I wanted to hear but I suppose it's a
> > possible solution. I wish there was a better way than having to manipulate
> > my dataset with dummy data. Thank you again.
> >
> > "EMartinez" wrote:
> >
> > > On Oct 3, 3:48 pm, justinsaraceno
> > > <justinsarac...@.discussions.microsoft.com> wrote:
> > > > Hello,
> > > > Using SSRS 2005 SP2, I have a report that has a multivalue parameter of US
> > > > states in a report that returns orders.
> > > >
> > > > I successfully can return order numbers along with the associated state
> > > > where the order was placed.
> > > >
> > > > However, if I select the states of NH, VT, and MA and there are no orders
> > > > from VT, I still need a group header for VT to show that there was no data
> > > > for VT. So my thought was to create a report grouping based on the states
> > > > selected in the multivalue State parameter. I can't find a way to do this.
> > > >
> > > > Also, I know I could use a subreport to resolve this but it is not an option
> > > > here. I need this report to be exported to MS Excel and subreports do not
> > > > export to Excel.
> > > >
> > > > Thank you,
> > > > Justin
> > >
> > >
> > > >From your description, you will most likely want to insert dummy rows
> > > in the returned dataset from the stored procedure/query that is
> > > sourcing the report based on the parsing out of the multi-select
> > > parameter. Hope this helps.
> > >
> > > Regards,
> > >
> > > Enrique Martinez
> > > Sr. Software Consultant
> > >
> > >|||On Oct 4, 8:08 am, justinsaraceno
<justinsarac...@.discussions.microsoft.com> wrote:
> Thank you Enrique. It's not the answer I wanted to hear but I suppose it's a
> possible solution. I wish there was a better way than having to manipulate
> my dataset with dummy data. Thank you again.
> "EMartinez" wrote:
> > On Oct 3, 3:48 pm, justinsaraceno
> > <justinsarac...@.discussions.microsoft.com> wrote:
> > > Hello,
> > > Using SSRS 2005 SP2, I have a report that has a multivalue parameter of US
> > > states in a report that returns orders.
> > > I successfully can return order numbers along with the associated state
> > > where the order was placed.
> > > However, if I select the states of NH, VT, and MA and there are no orders
> > > from VT, I still need a group header for VT to show that there was no data
> > > for VT. So my thought was to create a report grouping based on the states
> > > selected in the multivalue State parameter. I can't find a way to do this.
> > > Also, I know I could use a subreport to resolve this but it is not an option
> > > here. I need this report to be exported to MS Excel and subreports do not
> > > export to Excel.
> > > Thank you,
> > > Justin
> > >From your description, you will most likely want to insert dummy rows
> > in the returned dataset from the stored procedure/query that is
> > sourcing the report based on the parsing out of the multi-select
> > parameter. Hope this helps.
> > Regards,
> > Enrique Martinez
> > Sr. Software Consultant
You're welcome. Sorry that I could not be of greater assistance.
Regards,
Enrique Martinez
Sr. Software Consultant