The task is to make a simple report, that would look like this:
Trees Planted (Previous Week) Quantity Weight
OAK 720 544
APPLE 150 138
PEAR 430 411
PINE 602 589
CHESTNUT 384 357
Sum: 2 286 2 039
I need to pull in the data of different planting events, which are expressed in columns: TREE, QTY, WEIGHT.
Now, the problem (or a challenge) is:
I guess, first point is as easy as:
select TREE
from TREETABLE
group by TREE
order by TREE
Than the second point would be something like:
select QTY
from TREETABLE
where SYSDATE >= next_day(trunc(sysdate), 'MONDAY') - 14
and SYSDATE < next_day(trunc(sysdate), 'MONDAY') - 7
and TREE='OAK'
But I know, that there's something wrong here.. Because this way we need to specify a TREE for each cell. It probably would be better to make it relative and linked with the first column. Or is there a feature in BIRT itself to make this kind of relation?
Well it looks like a simple "group by" query, no need for BIRT to enter into the scene at this point. Set this kind of query in the dataset and you are done:
select TREE, sum(QTY) as QTY, SUM(WEIGHT) as WEIGHT
from TREETABLE
where SYSDATE >= next_day(trunc(sysdate), 'MONDAY') - 14
and SYSDATE < next_day(trunc(sysdate), 'MONDAY') - 7
group by TREE
order by TREE
And create totals in the footer of the BIRT table
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.