Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » BIRT » Total 500 records for two rows(preview results show 500 records for just two rows)
Total 500 records for two rows [message #1389386] Fri, 27 June 2014 18:33 Go to next message
ankita muley is currently offline ankita muleyFriend
Messages: 5
Registered: June 2014
Junior Member
Hi everyone! I am new to birt.I am using designing BIRT report in plugin project. I have pojo as my data source. I can print the rows in the fetch method to the console correctly. However , when I switch to preview tab I get see
Total 500 records are shown.Results contains more records that are not displayed.
However, I should get two rows. Also all the 500 records are same.
Also , I turned on Suppress duplicates. Can somebody help me out with the right solution.
Re: Total 500 records for two rows [message #1389586 is a reply to message #1389386] Sat, 28 June 2014 02:25 Go to previous messageGo to next message
Michael Williams is currently offline Michael WilliamsFriend
Messages: 1925
Registered: July 2009
Senior Member

What version of BIRT are you using? Are you not using 4.3+ where you have a POJO data source? If using a scripted datasource, it just sounds like something is broken when incrementing your loop. Can you post your code in the open and fetch methods if using a scripted dataSet?

Michael

Developer Evangelist, Silanis
Re: Total 500 records for two rows [message #1391202 is a reply to message #1389586] Mon, 30 June 2014 15:39 Go to previous messageGo to next message
ankita muley is currently offline ankita muleyFriend
Messages: 5
Registered: June 2014
Junior Member
Hi Michael, I am using version Birt version 3.7.2. I am using scripted data source.
my open method :

importPackage(Packages.dcModel);
importPackage(Packages.java.lang);

/* Create instance of modelDaoMock which provides data */
centerData = new ReportingToolDataProvider();
if(centerData==null){
System.out.println("message is null");
}

outtemp = centerData.getOuttemp();
/* Create instance of Room which provides data */
centerRoom = centerData.getDataCenterModel();


rackList = centerRoom.getRacks();
cracList = centerRoom.getCracs();
tileList = centerRoom.getTiles();


And fetch method:

varcount = 0;
rs = rackList.size()
cs = cracList.size()
ts = tileList.size();

maxCount = (rs+cs+ts)-1;

if(varcount < maxCount){

System.out.println("var count "+varcount+"maxCount"+maxCount);
row["OutsideTemperature"] = outtemp;
row["RoomDimension"] = RDimen;

rCount = 0;
if(rCount < rackList.size()){
row["NumberOfRacks"] = rackList.size();
while(rCount<rackList.size()){

System.out.println("Rack while loop"+rackList.get(rCount).getRackDimension());
row["RackDimension"] = rackList.get(rCount).getRackDimension();
row["RackAirflow"] = rackList.get(rCount).getAirflow();
row["RackPower"] = rackList.get(rCount).getPower();
row["IsRackDucted"] = rackList.get(rCount).isDucted();
rCount++;
varcount = varcount+1;


}
}


cCount = 0;
if(cCount < cracList.size()){
row["NumberOfCracs"] = cracList.size();
while(cCount<cracList.size()){
System.out.println("Crac while loop"+cracList.get(cCount).getCracDimension());
row["CracDimension"] = cracList.get(cCount).getCracDimension();
row["CracAirflow"] = cracList.get(cCount).getAirflow();
row["CracSupplyTemperature"] = cracList.get(cCount).getSupplyTemp();
cCount++;

varcount = varcount+1;
}
}


tCount = 0;
if(tCount < tileList.size()){
row["NumberOfTiles"] = tileList.size();
while(tCount<tileList.size()){
System.out.println("tiles while loop"+tileList.get(tCount).getPerforatedRatio());
row["PerforatedRatio"] = tileList.get(tCount).getPerforatedRatio();
tCount++;

varcount = varcount+1;
}
}

return true;
}

System.out.println("var count "+varcount+"maxCount"+maxCount);

return false;
Re: Total 500 records for two rows [message #1391280 is a reply to message #1391202] Mon, 30 June 2014 17:45 Go to previous messageGo to next message
Michael Williams is currently offline Michael WilliamsFriend
Messages: 1925
Registered: July 2009
Senior Member

The first thing I see is that varcount=0 will need to be moved to your open method. By having it in the fetch method, it's called for every single row, meaning that your count starts over each time you fetch a row. This would be why you're getting the first row many times. You probably also have other issues with how you increment varcount in each if statement and possibly others with your while loops. Inside a single fetch statement, you'll just be overwriting the row value each time the while loop passes, but maybe that's what you're trying to do. Anyways, let me know what happens after you move the varcount=0 line to your open method.

Michael

Developer Evangelist, Silanis
Re: Total 500 records for two rows [message #1391297 is a reply to message #1391280] Mon, 30 June 2014 18:22 Go to previous messageGo to next message
ankita muley is currently offline ankita muleyFriend
Messages: 5
Registered: June 2014
Junior Member
I moved the varcount to open method. and Now the one record in the result set. Regarding the increment of varcount, I am trying to output all the XXXlist, and hence I am increment varcount till all the XXXlist are traversed. But as you are saying it's actually overriding the row value hence one record only.How can I make it work without overwriting. Also Is it possible to group output of these list.

[Updated on: Mon, 30 June 2014 18:33]

Report message to a moderator

Re: Total 500 records for two rows [message #1391320 is a reply to message #1391297] Mon, 30 June 2014 19:19 Go to previous messageGo to next message
Michael Williams is currently offline Michael WilliamsFriend
Messages: 1925
Registered: July 2009
Senior Member

You're only wanting two rows, right? I'm not sure what you're trying to do with your tileList, cracList, and rackList loops, so it's hard for me to say. The fetch method only outputs a single row, so if you're attempting to produce more than one row within your while loops, it won't happen.

I guess what you're doing with the maxcount will work since you're duplicating the counts and then incrementing varcount each time, so that probably won't hurt anything. You probably don't need to subtract one from the summation though.

If you can show me what you're getting or at least some dummy data of what you're getting and what you're expecting, I can probably figure out more.


Michael

Developer Evangelist, Silanis
Re: Total 500 records for two rows [message #1391333 is a reply to message #1391320] Mon, 30 June 2014 19:41 Go to previous messageGo to next message
ankita muley is currently offline ankita muleyFriend
Messages: 5
Registered: June 2014
Junior Member
I was attempting to produce more than one row within your while loops. I have attached java file.
I want to extract each subitem of the list. based on that I want to call getXXX() methos. I am expecting a report like this:

Rack1 :
power, airflow, etc.
Rack2 :
power, airflow,temp, etc.

for all racks. Similarly for other lists too.

Re: Total 500 records for two rows [message #1391536 is a reply to message #1391333] Tue, 01 July 2014 03:40 Go to previous message
Michael Williams is currently offline Michael WilliamsFriend
Messages: 1925
Registered: July 2009
Senior Member

Any way you can send me the rest of the java files so I can just set it up? If you can't post them in here, you can email them to me at mwilliams.actuate at gmail.

Michael

Developer Evangelist, Silanis
Previous Topic:Is there a way to customize the ticks on the x-axis of a chart?
Next Topic:How to connect the points between series
Goto Forum:
  


Current Time: Tue Nov 21 01:07:46 GMT 2017

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

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