Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » BIRT » How can I get and set the actual row count of a dataset?
How can I get and set the actual row count of a dataset? [message #1105018] Mon, 09 September 2013 08:28 Go to next message
Sven Lorenz is currently offline Sven LorenzFriend
Messages: 3
Registered: September 2013
Junior Member
Hello,

I'm using BIRT 4.2 and got some issue which might be fixed easily if I would knew the command (well and if it's possible). I'm getting some data from a database. This data has a flag which is used for the following example:

The data of the database should be filled in two datasets filtered by the flag. If the flag is 1 then the data should be filled in the first dataset and if its 2 then it should be filled in the second dataset. So far so good from here. I've managed to fill the datasets, but my problem is that I get freespaces in the datasets for the data which doesn't match and hasn't been filled in the dataset. Here is the code for one of the datasets:

if(lstStatistic != null && count < lstStatistic.size()){
	if (lstStatistic.get(count).getLineCount()==2) {
		row["columnCustNr"] = lstStatistic.get(count).getFkCustomerId();
		row["columnCompany"] = lstStatistic.get(count).getCustomerCompany();
		row["columnContact"] = lstStatistic.get(count).getCustomerFirstName() + " " + lstStatistic.get(count).getCustomerLastName();
		row["columnStreet"] = lstStatistic.get(count).getCustomerStreet();
		row["columnPOB"] = lstStatistic.get(count).getCustomerPOBox();
		row["columnZip"] = lstStatistic.get(count).getCustomerPostcode();
		row["columnCity"] = lstStatistic.get(count).getCustomerTown();
		row["columnPhone"] = lstStatistic.get(count).getCustomerPhone(); 	
	}
	count++; 
	return true;
} 
 
return false;


The problem here seems to be the get(count) part. This is ok so I get the next data of the database, but it also seems to set the row count of the datasets. So if I want to get the first data and the third then the first row and the third row of the dataset will be filled. The second row gets a freespace which is also shown on the printout.

So is it possible to get the actual row count of the dataset while filling it in fetch? And is it also possible to change the row count with a kind of set method?
I want to fill the second row of the dataset with the third data of the database. with no freespaces. I hope I could manage to explain my problem clearly.
Re: How can I get and set the actual row count of a dataset? [message #1106171 is a reply to message #1105018] Tue, 10 September 2013 19:58 Go to previous messageGo to next message
Kristopher Clark is currently offline Kristopher ClarkFriend
Messages: 130
Registered: January 2013
Senior Member
One quick solution would be to create a computed column with the aggregation type of count. Then in your on fetch you could do something like

if(row["COMPUTEDCOLUMN"].value == 3 || /*other values/*) {
// do something
}
Re: How can I get and set the actual row count of a dataset? [message #1106547 is a reply to message #1106171] Wed, 11 September 2013 08:37 Go to previous messageGo to next message
Sven Lorenz is currently offline Sven LorenzFriend
Messages: 3
Registered: September 2013
Junior Member
Hi Kristopher,

thanks for the hint and your help. Sorry for asking this. I just want to get it right. I create a column which aggregates the rows that already have been created in the dataset. Then I make your if clause in the onFetch script. Is this correct?

I can see how I'm able to get the row count but I somehow don't understand how this sets the row count. This might be my misunderstanding or I haven't describe my problem clearly. I've attached a graphic which shows what the result should be. I hope it also shows that the amount of the data varies and that the setting of the flags is also variable. If your hint was exactly the solution for my problem then I apologize again.
  • Attachment: graphic.pdf
    (Size: 119.30KB, Downloaded 278 times)
Re: How can I get and set the actual row count of a dataset? [message #1106663 is a reply to message #1106547] Wed, 11 September 2013 11:32 Go to previous message
Sven Lorenz is currently offline Sven LorenzFriend
Messages: 3
Registered: September 2013
Junior Member
OK. Sometimes things can be easier solved than you've thought. I've used the filter function of the table and the freespace isn't shown anymore.
Previous Topic:Sub item
Next Topic:can't get results of stored procedure for my dataset
Goto Forum:
  


Current Time: Fri Apr 26 01:27:45 GMT 2024

Powered by FUDForum. Page generated in 0.02960 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top