How to generate mutiple pages with BIRT Report Designer - report

I would like to generate multiple page of a report. The number of pages would be defined in a variable from a Data Set.
example: if the variable is set to 5, the report would be generated in 5 copies (1/5, 2/5.. 5/5).
I'm using BIRT Report Designer 4.4.0.
The rest of the report is filled with other data that would stay the same in the n pages.
I managed to show the page number and the total number of pages (the variable) but didn't manage to generate that amount of pages.
I have no clue how to proceed, so until now, I only manage to generate 1 page.

You can use either a scripted data set or some SQL statement (for e.g. on Oracle something like this)
select rownum from user_objects where rownum <= :pi_num_copies
to create a "for-loop" data set.

I would try the following.
Insert (into the report) a Table binded to your Data Set with a
single column - your "NumberOfCopies" field.
Add Group for the NumberOfCopies.
Put your repeating n-times data to the Table Detail (you can replace the original field with it). Add fixed (for
every page) info to Group header and footer.
Set After property to Always in Page Break paramener
section for Group Footer (not for table's one!)
I guess it will work. If not - play around with Page Break options in Table Footer and Detail...

Related

Is it possible to filter the list of fields when outputting a Full Dataset?

I have a DataTable that I'm passing to a FlexCel report. It contains a variable number of columns, so I'm using the Full Dataset feature (e.g. <#table_name.*>).
However, only a subset of the fields are dynamically generated (I have a variable number of attachments). The column name for each attachment field starts with a common word (e.g. "Attachment0", "Attachment1", etc).
What I would like to do is output the known finite set of fields and then the variable number of attachments. It would be nice if I could write something like <#table_name.Attachment*> (and <#table_name.Attachment**>). Is there any way in FlexCel Reports I can achieve the same result?
A side benefit to such a solution means that I could keep the formatting for the known/finite set of fields.
Update
I added place holder columns to the document, each with a <#delete column> tag, so that the un-wanted columns/data are removed.
Although this works, it's not ideal. For example, if I want to see how the columns fit in the page width (in print preview), then I need to hide the columns. Then I have to remember to un-hide them again, so other developers can see/understand my handy work.
It would be much more straight forward if I could filter the fields before they're output to the document.
I realised there's an alternate way around this problem. I broke up the data into two sets of data - <#table_name.*> and <#table_name_attachments.*>.
The fixed set of fields are in the first table and the variable set of fields is in the second table (all the "Attachment*" fields). When the report is run, I place them next to each other (in the same order) in the same worksheet. This means I have two table ranges - "_table_name_" and "_table_name_attachments_" on the one sheet.
Now I'm able to run my print preview without hiding/re-showing the columns-to-be-deleted. I've also eliminated human error - it was all to easy to accidentally set the wrong number of padded/delete columns.

Trying to get a text box in access to display the latest row in a query on button press

I have this code for the text box Control Source in Access:
=DLookUp("[Lot Number]","[Lot Number Generator Table Query]")
but that will only display the first row generated in the query. I need to get the latest one generated displayed. I've tried switching the ascending/descending order with no change.
Assuming LotNumber is sequential and that there are two tables to consider, try:
=DLookUp("[Lot Number]","[Lot Number Generator Table Query]","[Lot Number]=" &
Dmax("[Lot Number]","[Some Table]"))
Or much more simply, if there is only one table:
=Dmax("[Lot Number]","[Lot Number Generator Table Query]")
This is not safe in a multiuser environment or when Lot Number is an autonumber.
See also Domain Aggregate Functions

Lookup field appears as numerical values instead of text on Access report

I am trying to create a report putting a field called contact which has the name of a person. This name is linked directly to another table where I keep all the contacts.
For some strange reason, when I include this name (which in query view displays as the name of the contact), instead of the name appearing, the unique ID number is shown on my report.
As mentioned in the article cited in the above comment, you can use a Combo Box control on your report to do the lookup for you. To see how this can be done, create a new report based on the table containing the lookup field, then drag and drop that field onto the report. That will create a Combo Box control with properties that look something like this:
Row Source: SELECT [Clients].[ID], [Clients].[LastName] FROM Clients;
Bound Column: 1
Column Count: 2
Column Widths: 0";1"
You could use a similar Combo Box control on your actual report to display the client's name rather than their numeric ID value.
Another alternative would be to change the Control Source of the report's Text Box control to have it do a DLookUp() on the table. If the lookup field is named [client] then changing the Control Source of the Text Box to something like
=DLookUp("LastName","Clients","ID=" & [client])
would also work.
I wanted to add to the great answer by Gord:
When using a "web" database (started in Access 2007 I think), you cannot change a report's fields to ComboBox style, nor can you use DLookUp(). (web databases lack a ton of features)
The workaround for this, if you want to create a Web-Report that uses lookup fields, is to create a Web-Query first based on your Web-Table (all the Web-* stuff has a www planet icon over the logo, if you create a new Web-DB in Access 2007+ you'll see what I mean)
So, instead of Table -> Report, you'll have to do W-Table -> W-Query -> W-Report.
Then, the only thing you need to customize to get the data right is the W-Query. Start by trying to reproduce the look in the query to match what you want users to see in the report. Note that here in the query, lookups will work fine (instead of the unique ID's, you get field names like you want). However, this will not carry over to the report. To do that, you gotta get the actual text field name you want into the query:
You should already have one table in your query; start by adding the table that your first lookup field points to. For example, the table I want to print is called Stock_Boards, and it has a lookup field called PCBID_lookup that points to the table Stock_PCBs.
Since you're using lookup fields, there should already be a relationship line between the two tables when you add the second one. If there isn't, something has gone horribly wrong.
Now, see how that line connects two fields on the two different tables? For example, I've got my PCBID_lookup field on my Stock_Boards table, which connects to the ID field on my Stock_PCBs table. If I created a report from this now, PCBID_lookup would be a number, a number that correlates to the ID of a record on Stock_PCBs.
To fix it, I will add the name field I want to show up on the report. In my example, that happens to be a Part Number, rather than the ID. I add the PartNumber field from my Stock_PCBs table to the query, and remove the PCBID_lookup field of the Stock_Boards table from my query.
Since PartNumber is what I want to show up on my report, it effectively replaces the original field (PCBID_lookup)
Repeat for all lookup fields you want in your report.
I had 1 more: I removed the Status field of the Stock_Boards table (which was an ID/Lookup) and added the 'Status' field from the Status table (which was the actual text name)
When finished, your query should look exactly how you want the data to appear, without any special tricks or asking Access to do something unnatural. Save your query, and create a web-report from it. Done!

ASP.Net Report Viewer - Same report multiple times with different parameter values

I'm currently working on an ASP.Net WebForms application that allows a user to select an item from a list, which ultimately results in a SSRS report being shown, using Report Viewer 2010 (in server mode). The report has been coded with a parameter #id to allow the report to display the correct data for the selected item.
The reports dataset can return multiple rows where some of the data is displayed in a summary area at the top (not in the header section) for example a textbox would have the expression =FIRST(Fields!Address.Value, "dsMain"). The data returned is denormalized so Address will always be the same value. Which is why using FIRST() works. And the rest of the data is shown in a Tablix with grouping applied etc.
But now I'm looking to change this so users can select multiple items and therefore effectively show the report multiple times, but shown in the same report viewer control. The main requirement is to batch print the reports, so showing it in one report view control is important to allow for one click printing of everything.
Now because I didn't design the report in the first place and because its fairly complex in its layout and the sql that is executed; the sql is geared towards running for one id and not a list of them. I'm looking for options to not have to rewrite the report or the sql.
Is it possible to give the report viewer the id parameter as a list and let the report viewer execute same report for each id passed? - I know report parameter can accept multiple values but this isn't the same since the report will unintelligently pass the first value to my stored procedure but not repeat the report for the other values. Perhaps there's a setting in the report designer that allows it to repeat if it is passed multiple values?
Can someone suggest something else to get this working? Or is my only option to extend the report and sql to accept multiple id's and effectively redesign the report?
Thanks any suggestions or help with this.
The answer is to use sub-reports.
Create a new report that takes a list of ids as a multi valued parameter.
Use that parameter as the dataset for a list control.
Have a subreport inside the list. Report inside the list is your original report.
You can then pass each element of your dataset(your list of parameters) as parameter to the your sub-report.
SSRS will repeat it as your want.

Grouping data in an RDLC

I'm sorry if this seems silly, but I'm new to using Report Definition Language (RDLC) files and I'm looking for advice on the best "plan of attack" for a report I must create.
THE REPORT
The report (itself) must display a table of data above a related set of calculations for each a grouping (of data). I'm hoping to keep one group per page...but that may not be possible as each table may become quite long (but that is another question for another day).
...There can be 1 to N GROUPS
Example
(GROUP 1)
TABLE
FORM CALCULATIONS
PAGE BREAK
(GROUP 2)
TABLE
FORM CALCULATIONS
...and so on.
IS THIS THE BEST WAY TO DO THIS?
Place each group into a SUBREPORT. The sub report would then contain the table & form calculations.
...is this right or is there a better way to do this?
THE ACTUAL ANSWER IS
The outer RDLC contains a LIST control which contained the following controls:
TABLE (containing items related to the collection as a whole)
SUBREPORT
The SUBREPORT points to an RDLC which contained the following controls:
TABLE (containing row items)
(1) Use the LIST's "grouping" property to group your 1-to-N collections. The "grouping" property is found by choosing the LIST control then choosing Visual Studio's menu options as such: VIEW > PROPERTIES WINDOW.
(2) Next, set the LIST's data source.
This is found using by choosing the REPORT and then choosing Visual Studio's menu options as such: REPORT > DATA SOURCES. Drag any field onto the control and the data source will automatically set itself up.
NOTE:
If you cannot "see" any data sources in Visual Studio's data sources window it is "probably" because service references in your project are causing issues...temporarily exclude them from your project and choose RESFRESH icon within Visual Studio's data sources window (they should then appear). Sadly, you must do this EVERY TIME your data source changes.
Once you have the LIST iterating properly you can add-in the SUBREPORT and any other controls.
...I now OFFICIALLY hate RDLC's.
personally if i had to do this report i will do it with two different tables. In one rdlc you can put two datatables one will display GROUP 1 Data the second one GROUP 2 Data. The Table has option Page break at end of datatable which can give the PAGE BREAK Between the two datatables.
Best Regards,
Iordan

Resources