accessing data between tables with different databinding [message #932945] |
Thu, 04 October 2012 15:42 |
Blaine Mising name Messages: 25 Registered: December 2010 |
Junior Member |
|
|
I've a report that contains some tables, and each table has a different dataset to show different information of same product.
These tables are inside a "global" table. The global table shows some columns of products (ID, description...) other table shows different information about the product like the historical of prices of the current product.
Other table shows the las status of the current product (if it is in stock or not)
I want to show in the footer row of "global" table some aggregations.
For example:
1. Count and show the total of products. This is easy. I can do an aggregation counting "id" rows
2. Count and show the products which are in stock. Here is my problem. I don't know how can I access in my global table to data that is in other table/dataset
I can put other status product table, but I think that this is not a clean solution.
I think that I can do it with global variables.
What is the best way to access data from different datasets?
[Updated on: Thu, 04 October 2012 15:45] Report message to a moderator
|
|
|
|
Re: accessing data between tables with different databinding [message #936807 is a reply to message #932945] |
Mon, 08 October 2012 11:08 |
Blaine Mising name Messages: 25 Registered: December 2010 |
Junior Member |
|
|
Thanks for your help.
I can do it with variables, as you did in the report example.
How can I get the time (in HH:MM format) between two dates?
My report shows when a product is bought (a databinding) and sold (other databinding). I want to show in other column the time elapsed between these events.
For example:
-----PRODUCT ID ------ BOUGHT ------------------ SOLD --------------ELAPSED TIME ------
------1-------- ----2012-01-01 10:00:00-------2012-01-02 10:01:00-----24:01:00---------
(Dates are in YYYY-MM-dd HH:MM:SS format)
The bough and sold dates are stored in global variables, then I did a databinding "time" object, and in "create" script I tried this:
this.setDisplayValue(reportContext.getGlobalVariable("BDATE") - reportContext.getGlobalVariable("SDATE"));
but it doesn't work.
I tried:
var diffMin = BirtDateTime.diffMinute(reportContext.getGlobalVariable("BDATE"),reportContext.getGlobalVariable("SDATE"));
if(diffMin>15){
this.setDisplayValue(difMin);
}else{
this.setDisplayValue("");
}
This shows the minutes, but not in HH:MM format, for example: 130 (02:10)
How can I show it in HH:MM format?
[Updated on: Mon, 08 October 2012 12:57] Report message to a moderator
|
|
|
|
Re: accessing data between tables with different databinding [message #938094 is a reply to message #937342] |
Tue, 09 October 2012 14:40 |
Blaine Mising name Messages: 25 Registered: December 2010 |
Junior Member |
|
|
Thank you very much!!
I've a problem, and I don't know if its a bug of Birt 4.2.0 or I am doing something wrong.
I've the Bought and sold dates of each product in 2 global variables.
I've 2 data objects, one for purchase date and the other for sale date. These objects are datetime, and expression value is this.setDisplayValue(reportContext.getGlobalVariable("BDATE")); for purchase date, and this.setDisplayValue(reportContext.getGlobalVariable("SDATE")); for sale date.
When I preview the report, eclipse shows data correctly, but when I deploy and run the report in my browser the dates of 2 objects doesn't appear correctly.
I changed them with 2 labels with this.text = reportContext.getGlobalVariable("BDATE"); and this.text = reportContext.getGlobalVariable("SDATE"); and dates appears correctly in browser mode too.
I want to use data objects because they format dates automatically. How can I format dates as data objects does?
Why is not working with data bindings objects? It's a bug? How can I solve it?
[Updated on: Tue, 09 October 2012 14:46] Report message to a moderator
|
|
|
|
Re: accessing data between tables with different databinding [message #939215 is a reply to message #938303] |
Wed, 10 October 2012 14:29 |
Blaine Mising name Messages: 25 Registered: December 2010 |
Junior Member |
|
|
I did it and is a java.util.Date object
I solved it with labels and this code in onCreate method:
importPackage( Packages.java.text );
var mydt1 = reportContext.getGlobalVariable("BDATE");
var sdf = new SimpleDateFormat("dd-MM-yyyy HH:mm", reportContext.getLocale());
var mydtf1 = sdf.format( mydt1 );
this.text = mydtf1;
But I don't understand why is not working with edit objects. I updated to Birt 4.2.1 but with same results. Can be a bug?
I've other problem, I want to check if products are delayed or not, and if they are not delayed, hide all the row, because the table has a databinding with all the products.
I implemented the code in Visibility expression property of the row, and it works fine, only products delayed are shown, but the pages in browser has different number of visible rows.
It happens because birt takes account the number of total rows, and not only visible rows. For example, the second page only shows 3 products, and the third page shows 15.
How can I solve this and show the same number of visible rows per page?
[Updated on: Wed, 10 October 2012 14:46] Report message to a moderator
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03082 seconds