Wednesday, March 21, 2012

Displaying values in list from Left-Right instead of Right-Left

Hi,

I want to display values in a listbox from left to right instead of top to bottom.

Instead of displaying values like this

D001

D002

D003

D004

..

..

..

I should display

D001 D002 D003 D004 D005 D001 D002 D003 D004 D005 D001 D002 D003 D004 D005

D001 D002 D003 D004 D005 D001 D002 D003 D004 D005 D001 D002 D003 D004 D005

D001 D002 D003 D004 D005 D001 D002 D003

I also should restrict the length of the listbox. Maximum of 20 values only should displayed per row.

Is there any way to acheive this ? Either using Table or Matrix dataregion ? Or concatinating string in a textbox ?

Regards,

I have done something similar for a mailing label report. i had to create a list box for each section LTR then when my data is returned i determine which list to put it into based off the record number.

Example: My report has 3 list controls placed next to each other.

Record Number Data

1 Blah 1

2 Blah 2

3 Blah 3

4 Blah 4

5 Blah 5

... ...

Record number 1 display in Fist list control, record number 2 displays in second list control, record number 3 displays in third list control, record number 4 display as second record in first list control, record number 5 displays as second record in second list control, and etc.

Eample Filter on List Control: =Code.SetColumn(CLng(Fields!ColumnFilter.Value),3) = 2

SetColumn Code:

Shared Function SetColumn(ByVal row As Integer, ByVal ColumnCount As Integer) As String
Dim RetVal As Integer = row

While RetVal > ColumnCount
If ColumnCount >= RetVal Then Exit While
RetVal = RetVal - ColumnCount
End While

Return RetVal
End Function

Also to return the sequential number with your data set look into SQL 2005 Ranking functions.

|||

Hi,

I was able to acheive this as follows -

1. Add a Matrix control. Add required field in column grouping of matrix. (Dynamic columns)
2. Add a ListBox control. Include Matrix inside the Listbox.
3. Edit details of Listbox to add a group expression =RowNumber(Nothing) / 15. (15 is number of columns to be displayed)
4. Add a Matrix column group expression as your Listbox group expression.
=RowNumber("list1_Details_Group"). Now your matrix should contain 2 group expressions. (1 for Phone # and other for controling no. of columns).

Regards,
Chiro

|||

I dont understand how you can have the expression in step 3 -

=RowNumber(Nothing) / 15

|||I think the technique is similar to the HorizontalTables example in Chric Hays Sleazy Hacks Blog. There's a working example you can download from http://blogs.msdn.com/chrishays/archive/2004/07/23/HorizontalTables.aspx

No comments:

Post a Comment