Showing posts with label sorting. Show all posts
Showing posts with label sorting. Show all posts

Wednesday, March 21, 2012

Problem with sorting in exported Excel document

Hello. I am using Reporting Services 2000 and Microsoft Excel 2003 running on
Windows XP Professional. I have a report that contains sales information that
I am exporting to Excel. The first two lines of the report contain title
information. They span all columns of the report. For example, the first line
(let's call it Food Sales Information) spans 15 columns. After the first two
lines of title information, there is a line containing the names of the
columns. After that, I have a lot of lines containing the sales data. I
export this to Excel. When I click in one of the numeric columns and click
the "A->Z" (sort ascending) button, I get the following error:
"This operation requires the merged cells to be identically sized."
Clciking Show Help gives me the following detail:
"This error only appears if you attempted to sort a range of previously
merged cells, but not all cells in the sort range were merged or are not of
the same size.
To avoid this behavior, unmerge all the merged cells in the range, or merge
all the cells in the range to be the same as the largest merged cell
grouping."
I believe this error to be caused the the two header rows. When I delete the
two header rows from the exported Excel document, I do not get the error.
Is there any way around this problem? Can I get the data to sort in Excel
without removing the header? Thanks in advance for the help.For those of you with this problem in the future who find this post
through google, Teo pointed me to a blog with this very issue
addressed. The bottom line is exporting to Excel from RS2000 leaves a
lot to be desired. Here is the blog with a work-around for this
problem:
http://blogs.msdn.com/chrisbal/archive/2006/07/08/659545.aspx

Problem with sorting

I am trying to set up custom paging and sorting with my gridview. All is well but the sorting. The problem is with the stored procedure. If I pass in the value @.sortExpression as, for example "discussions_Posts.post_time", i does not sort it at all. But if I replace the @.sortExpression with discussions_Posts.post_time in the actual stored procedure, it gets sorted.

how do I sort this query with a input parameter with values like "discussions_Topics.topic_title" or something?


ALTER PROCEDURE discussions_GetTopicsSubSet
@.startRowIndex as int,
@.maximumRows as int,
@.sortExpression as nvarchar(50),
@.board_id as int
AS

DECLARE @.Topics TABLE
(RowNumber INT,
topic_id INT,
topic_title VARCHAR(50),
topic_replies INT,
topic_views INT,
topic_type INT,
topic_time DATETIME,
post_id int,
post_time DATETIME,
Topic_Author_UserName nvarchar(256),
Topic_Author_ID uniqueidentifier,
Post_Author_Username nvarchar(256),
Post_Author_ID uniqueidentifier)

--DECLARE @.TopicsFrom Datetime

--SELECT @.TopicsFrom = CASE @.TopicsDays WHEN '1' THEN DATEADD(day,-1,getdate()) WHEN '2' THEN DATEADD(day,-7,getdate()) WHEN '3' THEN DATEADD(day,-14,getdate()) WHEN '4' THEN DATEADD(month,-1,getdate()) WHEN '5' THEN DATEADD(month,-3,getdate()) WHEN '6' THEN DATEADD(month,-6,getdate()) WHEN '7' THEN DATEADD(year,-1,getdate()) ELSE DATEADD(year,-1,getdate()) END
-- populate the table CAST(getdate() as int)
INSERT INTO @.Topics
SELECT ROW_NUMBER() OVER (ORDER BY @.sortExpression), discussions_Topics.topic_id, discussions_Topics.topic_title, discussions_Topics.topic_replies, discussions_Topics.topic_views, discussions_Topics.topic_type,discussions_Topics.topic_time, discussions_Posts.post_id, discussions_Posts.post_time, user_1.UserName AS Topic_Author_Username,
user_1.UserId AS Topic_Author_ID, user_2.UserName AS Post_Author_Username, user_2.UserId AS Post_Author_ID
FROM discussions_Topics INNER JOIN
discussions_Posts ON discussions_Posts.post_id = discussions_Topics.topic_last_post_id INNER JOIN
aspnet_Users AS user_1 ON user_1.UserId = discussions_Topics.topic_poster INNER JOIN
aspnet_Users AS user_2 ON user_2.UserId = discussions_Posts.poster_id
WHERE (discussions_Topics.board_id = @.board_id AND
discussions_Topics.topic_type NOT LIKE '1' )

SELECT * from @.Topics
WHERE RowNumber BETWEEN @.startRowIndex AND (@.startRowIndex + @.maximumRows) - 1

Hi ,

Just like dynamic selecting of column names are not permitted by sql server you also can't use dynamic column sorting.

To get the feature that you want. You have to concatenate and create a dynamic query and then execute the query to get your desired result.

Happy Programming,
Anton

Problem with size of text of title of column.

Hello :

In a title of a column of a table, I put a too long text, with sorting, but when I spread (display) the report has a problem on text of the title of the column there.

The probleme settles (arises) when I activate the sorting to post (show) the image of sorting.

How to fit the size of the cell to the text?

Thenk's.

.......|||Please click the Report Abuse link only if you have abuse to report. It is not going to attract attention to your post.