开发者

Reporting services display data format help

开发者 https://www.devze.com 2023-03-30 22:41 出处:网络
I have a Tablix and my query returns 5 records. Here is my query results. Please let me know how to display them. I appreciate any help. Thank you.

I have a Tablix and my query returns 5 records. Here is my query results. Please let me know how to display them. I appreciate any help. Thank you.

2      Test1            20
3      Test2            30
4      Test3            40
5      Test4            50

I have to display in the following format on the report.

Title        
-------------------------------------
obj1:   Test1                Percentage: 20
obj2:   Test2                Percentage: 30
obj3:   Test3                Percentage: 40
obj4:   Test4                Percentage: 50  开发者_开发问答   


Here is one way you can do this. The example was created in SSRS 2008 R2.

The example assumes that you have created a data source and created a report using the wizard with the help of a query.

This is the table structure I have used for this example.

Reporting services display data format help

Following query was used in the report and also the table records are shown.

Reporting services display data format help

Now, you have a report like this with each of your columns displayed separately in the report.

Reporting services display data format help

Right-click on the first column and select Expression...

Reporting services display data format help

Enter the expression ="Obj" + Cstr(Fields!Id.Value) + ":" + StrDup(10, " ") + Fields!Obj.Value + StrDup(10, " ") + "Percentage: " + CStr(CInt(Fields!Percentage.Value))

This query uses CStr to convert integers to string. I have used CInt for the numeric field to drop off the decimals. The function StrDup is to duplicate the space 10 times. You can specify the number to determine how many spaces you need.

Reporting services display data format help

Right-click on the column Obj and select Delete Columns.

Reporting services display data format help

Right-click on the column Percentage and select Delete Columns.

Reporting services display data format help

Expand the column Id and change the title text to Title. Run the report and here is the output.

Reporting services display data format help

Hope that helps.

0

精彩评论

暂无评论...
验证码 换一张
取 消