all groups > sql server reporting services > april 2007 >
You're in the

sql server reporting services

group:

Changing order of columns at run time


Changing order of columns at run time Richard.Gohs NO[at]SPAM Pa-Tech.Com
4/27/2007 7:39:10 AM
sql server reporting services:
Here's the scenario:

I want to be able to create a report (typically these reports are
"table like" reports ... in other words, several columns with a list
of data underneath) and I want to be able to re-order the columns (not
the rows) in these reports at runtime.

So, for instance, if the "report design" is as follows:

COLUMNA COLUMNB COLUMNC
.... data goes here ...


.... I'd like to be able to pass a parameter in to the report that may
be, for instance, "COLUMNC,COLUMNB,COLUMNA" ... and report columns
would re-order, like follows:

COLUMNC COLUMNB COLUMNA
.... data goes here ...


.... I don't really care what report designer object is used (Table,
Matrix, etc) ... but I don't yet see a good way to do this. It seems
like the Matrix object might be able to do this via the ColumnGroups
"Sorting" tab ... but I don't seem to be able to come up with an
expression that can make this occur.

Any help is greatly appreciated.

Thanks,
Richard
Re: Changing order of columns at run time EMartinez
4/27/2007 9:07:27 PM
[quoted text, click to view]


If you are using a matrix report, you can control the column layout
(assuming you know the column names prior to runtime) by adding spaces
in front of the names of the columns (like values in the pivot column)
and ordering/sorting by ascending order. If you are using a table
control, you can allow the user to select a sort order (asc/desc) in
the report and then set the columns in the returned resultset
accordingly. Hope this helps.

Regards,

Enrique Martinez
Sr. Software Consultant
Re: Changing order of columns at run time renhanyue
4/28/2007 12:00:00 AM
Just Like the report was built by Report Builder..
when click title of column ,the order will be change,right?
how to do it in vs2005?

"EMartinez" <emartinez.pr1@gmail.com>
??????:1177733247.239100.15830@n59g2000hsh.googlegroups.com...
[quoted text, click to view]

Re: Changing order of columns at run time Amarnath
4/30/2007 12:34:00 AM
That's called interactive sort. click on the textbox or table textbox
properties and select the interactive sort tab and set your values.

Amarnath

[quoted text, click to view]
Re: Changing order of columns at run time Richard.Gohs NO[at]SPAM Pa-Tech.Com
5/1/2007 7:14:54 AM
The issue is that I'm trying to change is the order of the columns
themselves (left to right) ... not the data "within" the column (which
would be the "top to bottom").

Normally, these reports would be simple "table" reports ... the
"extra" feature that I need to give to my users is the ability specify
the order of the columns (left to right)

To further clarify, if the report where a simple SQL statement, the
report designer might specify:

SELECT A, B, C FROM SOMETABLE

.... but I want to give the report "user" the ability to say

SELECT C, B, A FROM SOMETABLE

AddThis Social Bookmark Button