Birt Designer - Add Tables programmatically - reporting

i'm using Eclipse Birt Designer v4.4.1,
What i would like to do in the report that i'm designing is to add programmatically tables (the same table structure) in my report based on a value that i get from a database query.
Example :
if (queryValue = 1) ==> Add one table
if (queryValue = 5) ==> Add 5 tables
etc ...
Obviously i should add a loop that creates the tables.
Is there a way to do this in Birt Report Designer ?
Thanks.

the easiest way to do this, is to create 2 datasets in the report, the first generate the number of tables and binded to a table element, and the second generate the rows for each table and binded to a table element that is added inside the first table element in the report, and then using the visibility property, we could hide the irrelevant rows.

Related

Oracle Reports (6i): Get difference of two items from two different queries (Multi Query Report)

I have an Oracle 6i report with Two Complex Queries (Q1 and Q2) connected by Data Link. The report was developed by some other developer who is not available now. Multiple columns are being displayed in report.
Q1 has a column Total_Issuance and Q2 has a column Total_Consumption. I have to display their difference on report. I am using a formula column to get the difference and then binding a display field to this formula column to show on report.
But since the formula column is outside both the queries, I am getting following errors.
REP-1517: Coloumn 'CF_1' references column 'Total_Issuance', which has incompatible frequency.
REP-1517: Coloumn 'CF_1' references column 'Total_Consumption', which has incompatible frequency.
Just like the formula column is outside both queries, create two additional summary columns (outside of both queries):
cs_tot_iss, which will sum total_issuance
cs_tot_con, which will sum total_consumption
Now modify formula column so that its source are newly created summary columns, e.g. let it
return :cs_tot_iss + :cs_tot_con;
As of paper layout: you don't have to display cs_tot_iss nor cs_tot_con (as you already have those values via total_issuance and total_consumption), just add formula column.
Create a new calculated field to the query that is the detail query (I asume it's Q2).
In this calculated field you can simply use:
return :Total_Issuance - :Total_Consumption;
to calculate the difference.

Can I use a list to repeat two tablixes on a report page?

See image below. Warehouse and Customer are dropdown lists populated via query. Year is a text field. The two tables display data from datasets driven by the report parameters. Is there a way to repeat the two tables based on each member of the Customer dropdown? Preferbly with a pagebreak after the 2nd table.
I normally do this using subreports. You could either create a single subreport that contains both tables or individual subreports. The individual approach might help with page breaks etc so that's the way I'd go.
Step 1: Create a report for your first table.
As you don't state what each table does, I'll make some up for the sake of illustration.
The key is to create a subreport that displays just the info you need in a single table. So in your case this might mean we only need to pass in a single parameter, CustomerID. You might need to pass in more such as Warehouse but I don't know...
In my made up scenario, let's assume the report shows customer contacts so we create a subreport (let's call it subCustomerConacts). It has a single parameter pCustomerID and a single dataset dsCustomerContacts. The query might looks something like SELECT * FROM CustomerContacts WHERE CustomerID = #pCustomerID. Add whatever tables/textbox etc you need to display your data.
Test this subreport works by manually typing in a CustomerID
Step 2: Create a report for your second table.
Do exactly the same again, creating a new subreport. Let call this subCustomerOrders. Repeat as above until you end up with another report that can display order details (or whatever you need).
Finally, create you main report.
This is basically what you have described in you question in terms of parameters etc.
Now to add this bit that will call you subreports.
Create a dataset (let's call it dsCustomerLoop) that contains each customer from your parameter something like SELECT DISTINCT CustomerID FROM myCustomers WHERE CustomerID IN (#myCustomerParameter)
Add a table to your report, 1 column wide and stretch it so it's wide enough to accommodate you subreports.
Set the dataset to point to dsCustomerLoop
Right-Click the cell in the detail row and do "Insert Row -> Inside Group - Below". You should not have two detail rows.
Next, right click the top detail row and do "Insert -> Subreport"
Right-Click the newly inserted subreport control and choose "properties".
Choose your first SubReport form the drop-down list
Click parameters on the left,
Click "Add" and select the CusomterID parmeter, set it's value to the CustomerID field.
Repeat this process on the seconds row, choosing your seconds subreport.
You may want to also add a 3rd row to the table, you could insert a rectangle into this with page breaks set to force a new page after each seconds subreport.
That's It. When the report runs it will produce two rows per customer, each row containing a subreport.
I hope this is clear enough, I've rushed through it a bit but if anything is unclear, let me know and I'll provide a clearer solution.

Oracle Apex - Links in report row that gets a value from the row and uses it to generate another report on a different page

Oracle Apex 5.1
I have a report (Report A) that has a table of values generated from a SQL query.
How do I get a link column to get a value (e.g. employee_ID) of the current row then send that value to another page that has a report (Report B) that is generated using the value from report A.
New to Apex and a lot of the guide or tutorials seem very convoluted for something that seems like quite a standard thing.
Thanks for any help!
This is a pretty basic thing and there are many examples of it online.
The simplest way is to create a column link (in attributes) which links to your target page containing report B. On the page containing report B have a hidden item (e.g. employee_id) and in your link use the set items area to set PX_employee_id to value #employee_id#. Then on report B have a where clause - where employee_id = :PX_EMPLOYEE_ID (replace X with the relevant page number).

disabling sorting in CrossTab of Crystal Report

I have report with Crystal Report and there is a Cross Tab inside of it. In order to pass data to CrossTab I create a DataTable , do some processing on the data and pass it to Crosstab In Report, In Cross Tal I have 3 Group By's. I dont want the cross tab changes the sorting of data I have pass them to it.
This is by default happens in cross Tab Group by
But I dont want the value be sorted.
any Idea for that?
If you wish to maintain the order that the values are loaded into the report, the quickest way is probably to alter the SQL yourself.
Create a new returning field in your SQL statement that starts at 1 and increments with each record. Then tell the Crosstab to sort on the field you just made.

How to make a table with many columns in a report

I would like to create a report containing a table that will not fit to one page, since it has too many columns. I want BIRT to create a report that you can print and put the pages next to each other to get the whole table.
An Example:
My table has 20 columns, 10 fit on one page. The Table has enough rows to fill 2 pages. When I put the printed pages on a table like this:
P1 - P2
P3 - P4
I see the whole table with all 20 columns. How can I do that with BIRT report designer 3.7.0?
Since Birt is page oriented, I guess this will not work.
I guess you'll have to create one report with the whole table to display on the screen, and another "print optimized" one with two tables distributed over two pages.
I actually saw a similar question on the official BIRT eclipse forum. They suggested adding a page break inside the table and that should break up the columns across the different pages (unless I mis-understood what you are trying to accomplish).

Resources