开发者

Dynamic Reports using SSRS

Let me declare... I am a newbie at this filling in the spot temporarily at the moment.

Problem: Develop a application summary report using SSRS 2008( the completed product should be a RDL file, which can be deployed to the SSRS Server) for the online application completed by the applicant.

A little bit of background: The applicant fills in an online application using our web application, where he completes required and optional fields. The a开发者_JS百科pp summary report, is provided to the applicant filling out the application as a summary of his app and should display only the fields completed by the applicant.

Example:

Lest us say John Smith lives at

Add Line 1: 123 Any Street

Add Line 2: Null

City: Some City

State: Some State

And his spouse Jane Smith lives at

Add Line 1: 321 Any other Street

Add Line 2: Apt A

City: Some City

State: Some State

So in the report, the null field (Add Line 2) should not be displayed for john but displayed for Jane. When I say not displayed, meaning, the field label should be hidden the and report should adjust the spacing to not show a skipped blank line in the report.

We have about 1000 such fields that can or cannot be answered by the applicant. So the report should be generic and use as much of inbuilt functionality as possible.

If needed, an Xml containing key value pairs of fields and responses. this Xml can be made so that it can contain all fields and unanswered responses as null or only answered responses. i am not sure how this would help but putting it out there if needed.

I have done simple reports, but i have no idea on how to approach this situation. Any help will be great help.

Thanks.


I have had a similar situation and ended up using this approach within a textbox. Taking your example above, you would have this setup for your fields within the textbox, with the [ ] being fields from the dataset:

Name: [first_name] [m_name] [last_name]
Add Line 1: [address_1]
[expression]City: [city_name]
State: [state_name]
Zip: [zip_code]

Note that the expression and the City have no space between them. What happens is the city will be on its current line when [address_2] is null and move to the next line when there is an address line 2, using this expression:

=IIF(IsNothing(Fields!address_2.Value), "", 
“Add Line 2: “ & Fields!address_2.Value & VbCrLF)

When the IFF is true and [address_2] is null the expression will write “” (Nothing) and [city_name] will remain on the same line. When the IFF is false and there is an [address_2] the label “Add Line 2” will be written along with the value of [address_2] and the [city_name] will be moved to the next line by “VbCrLf”. A more robust method that handles if [address-2] has a string of length 0 or a few spaces is this expression:

=IIF(IsNothing(Fields!address_2.Value) OR Len(Trim(Fields!address_2.Value)) < 1, "", 
“Add Line 2: “ & Fields!address_2.Value & VbCrLF)

This stops the strange double space when a field is empty but not null; something similar woks great for middle names. Hopefully this is helpful to you or someone else reading this post.


This was really simple...

Lets say we have a report which is in a tabular format using rectangles and textboxes,

--------------------
|FIRST NAME : AAAA  |
|LAST NAME : BBBB   |
|PHONE: XXX-XXX-XXXX|
--------------------

Use the following expression to control visibility of the controls that you want to hide

=IsNothing(First(Fields!WorkPhoneNumber.Value, "DataSet1"))

Make sure all the controls are of the same height and width. I created a row with just 2 controls (the label text box and the value text box) and set their visibility using the value of the value text box as described in the expression above.

Since the row had just two controls the hiding the would auto adjust the layout as i desired.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜