Showing posts with label designing. Show all posts
Showing posts with label designing. Show all posts

Monday, March 12, 2012

repeating a header with fields from the dataset

Hi,

I'm designing a report and have the requirement that the report title needs to be repeated on each page. However, the report title is dynamic, retrieved from the database, so i cannot place it in the page header (what an annoyance). The solution i first thought of was placing the title in a table, repeating the table header on each page, however the problem i'm encountering is that when i have a subreport in that table, that subreport is in one row

--> if the subreport spans across multiple pages, the header will only be shown on the first page the row where the subreport is actually in...

any thoughts anyone on a possible solution?

1. Place a hidden textbox in the report body with a value of =First(Fields!<TitleField>.Value).

2. Place another textbox in the page header referencing the first textbox with a value of =ReportItems!<Textbox1Name>.Value.

|||

hi

thanks for the reply but that actually doesn't quite fully solve my problem; apparently it will only display the value of the textbox on the page where that textbox WOULD be rendered; my report consists of several subreports, i placed the hidden textbox "after" all the subreports, and the title would only appear on the last page.

Putting the textbox at the first place in the report yielded similar results; it would only display on the first page...

|||i'm testing the report by exporting to pdf, by the way|||

Yes, the report item will come back as null if not rendered on the page. If possible, make the hidden textbox repeatable on every page. For example, if the report has a table put the hidden textbox on a detail table row. You will need to change the scope of the hidden textbox expression to reference the dataset, e.g. =First(Fields!<TitleField>.Value, "<DatasetName").

An ugly hack, I know.

repeating a header with fields from the dataset

Hi,

I'm designing a report and have the requirement that the report title needs to be repeated on each page. However, the report title is dynamic, retrieved from the database, so i cannot place it in the page header (what an annoyance). The solution i first thought of was placing the title in a table, repeating the table header on each page, however the problem i'm encountering is that when i have a subreport in that table, that subreport is in one row

--> if the subreport spans across multiple pages, the header will only be shown on the first page the row where the subreport is actually in...

any thoughts anyone on a possible solution?

1. Place a hidden textbox in the report body with a value of =First(Fields!<TitleField>.Value).

2. Place another textbox in the page header referencing the first textbox with a value of =ReportItems!<Textbox1Name>.Value.

|||

hi

thanks for the reply but that actually doesn't quite fully solve my problem; apparently it will only display the value of the textbox on the page where that textbox WOULD be rendered; my report consists of several subreports, i placed the hidden textbox "after" all the subreports, and the title would only appear on the last page.

Putting the textbox at the first place in the report yielded similar results; it would only display on the first page...

|||i'm testing the report by exporting to pdf, by the way|||

Yes, the report item will come back as null if not rendered on the page. If possible, make the hidden textbox repeatable on every page. For example, if the report has a table put the hidden textbox on a detail table row. You will need to change the scope of the hidden textbox expression to reference the dataset, e.g. =First(Fields!<TitleField>.Value, "<DatasetName").

An ugly hack, I know.

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