Showing posts with label designer. Show all posts
Showing posts with label designer. Show all posts

Monday, March 26, 2012

how to arrange data horizontally in SQL Server 2005 report designer

I am wondering whether anyone knows, in SQL Server 2005 reporting service, how to arrange data (retrieved from a table field) horizontally (from left to right) instead of vertically (from top to bottom).

It is natural to arrange data vertically. However, it is not easy to arrange data horizontally. I tried using the multi-column feature in the reporting service to achieve the effect. It does not work. I also considered writing SQL code to transpose data (rows to columns, columns to rows). It does not help either.

Does anyone know how to achieve the effect? Is there a work-around?

Any idea, tip, or suggestion is greatly appreciated.

Thanks.

Use a matrix report on top of the data.|||

Besides using a matrix, you could also look into the "horizontal table" approach describes on Chris Hays' blog: http://blogs.msdn.com/chrishays/archive/2004/07/23/HorizontalTables.aspx

-- Robert

Friday, March 9, 2012

How to add fields to Report Designer from a Web Service or something equivalent?

Hello,

I am trying to add some fields to my report (Using SQL Server 2005 Reporting Services, Visual Studio 2005).

As of now I can only use fields from one of my tables, or use functions within SQL DBMS. However, sometimes I wish to do more complicated things which can not be done (or at least I don't know how to do) withing SQL DBMS.

I wish to write a C# function (Web service) which takes a bunch of parameters and spits out some text. Is it possible to add a field to the report which calls this Web service, sends a bunch of parameters and displays the result of the function.

If not, Is there any way at all to manipulate some data using C# and display the result in the report.

Thanks in advance,

Any help is much appreciated

Amir

If what you are asking is "Can report items be dynamically added to a report"? then the answer is yes.

You can dynamikcally add fields to a report by loading the RDL via a memory stream to the report viewer control in local mode. Prior to loading the RDL you will need to parse the XML in order to add the the field.

Wednesday, March 7, 2012

How to add a variable in Source view ?

There are 3 views in VS IDE, Designer, Code and Source.

In source view, there are html codes, how do I add a variable into it ?

For example:

<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:JJConnectionString %>"
SelectCommand="SELECT * FROM [Tbl]"

...

How to change the SelectCommand to like:

SelectCommand="SELECT * FROM [Tbl] WHERE [CREATEDBY] = '" & User.Identity.Name & "'"

The User.Identity.Name is not valid in source view, but i need it to work, are there any way ?

Hello my friend,

To use code within aspx/ascx files, you enclose it within <% %> tags. The page directive at the top of your aspx pages is an example of this.

<%@. %> is for directives

<%= %> is for simple printing of code/variables. Try this on your web page: -

<%

=User.Identity.Name %>

<%# %> is for pre-processing but usually used in binding controls to print/use fields of the data source: -

<asp:Repeater ID="rptCountries" runat="server" Visible="true">
<ItemTemplate>
<td width="200"><%# Container.DataItem("CountryName")%><br/>
</ItemTemplate>
</asp:Repeater>

Kind regards

Scotty