Monday, February 20, 2012

Rendering report fields

Hi,

I am designing a report that creates a letter to send to a named individual. To accomodate different address lengths, additional fields have been added to the db. Is there a method by which if an address filed is empty, it does not display in the redered report and the fields below it are moved up to close the gap?

Any one any ideas?

Thanks

Yes, you can use just one textbox with line feed and carriage return characters appended in between conditionally something like this:

Fields!Address1.Value &

IIf(Fields!Address2.Value <> "", Chr(10) & Chr(13) & Fields!Address1.Value, "") &

IIf(Fields!City.Value <> "", Chr(10) & Chr(13) & Fields!City.Value, "") &

IIf(Fields!State.Value <> "", Chr(10) & Chr(13) & Fields!State.Value, "")

.....

Shyam

|||

Hi Shyam,

Thank you for your response. I am new to this and am not sure how the coding fits in. Below is what I have currently:

=First(Fields!Name.Value)
=First(Fields!Address1.Value)
=First(Fields!Address2.Value)
=First(Fields!Address3.Value)
=First(Fields!Town.Value)
=First(Fields!County.Value)
=First(Fields!Post_Code.Value)

A further example of where your code fits in would be a great help.

Thanks

|||

I guess you have 7 textboxes one below another. Now, delete the bottom 6 textboxes and put this expression in the top textbox:

=First(Fields!Name.Value) &

IIf(First(Fields!Address1.Value) <> "", Chr(10) & Chr(13) & First(Fields!Address1.Value), "") &

IIf(First(Fields!Address2.Value) <> "", Chr(10) & Chr(13) & First(Fields!Address2.Value), "") &

IIf(First(Fields!Address3.Value) <> "", Chr(10) & Chr(13) & First(Fields!Address3.Value), "") &

IIf(First(Fields!Town.Value) <> "", Chr(10) & Chr(13) & First(Fields!Town.Value), "") &

IIf(First(Fields!County.Value) <> "", Chr(10) & Chr(13) & First(Fields!County.Value), "") &

IIf(First(Fields!Post_Code.Value) <> "", Chr(10) & Chr(13) & First(Fields!Post_Code.Value), "") &

Shyam

|||

That works a treat.

Thanks for your help

|||

Hi Shyam,

That works fine in the dev studio but when rendered from the reporting server, all fields are rendered on the same line. Is there a fix for this?

Thanks

No comments:

Post a Comment