me again with another report query... I've come across this before and resolved the issue, but having checked the existing report I cannot see where I am going wrong, so hopefully someone else looking at this will be able to help...
Basically, I have a report like any other, with two headers and a body section, and some static fields as programmable sections. The headers and programmable sections are fine and run as expected. The data within the body section comes from fields within the ProdBOM table, and there is a relationship between this table and the main table I am using as my datasource. Both of these are datasources in my report.
I have input the following code into the fetch method;
public boolean fetch()
{
ProdBom _prodBom;
LogisticsControlTable _logisticsControlTable;
;
queryRun = new QueryRun(this);
if (!queryRun.prompt() || !element.prompt())
{
return false;
}
while (queryRun.next())
{
if (queryRun.changed(tableNum(LogisticsControlTable)))
{
_logisticsControlTable = queryRun.get(tableNum(LogisticsControlTable));
if(_logisticsControlTable)
{
element.newPage();
}
this.send(_logisticsControlTable);
if(_logisticsControlTable.ProdId)
{
while select _prodBom where _prodBom.ProdId == _logisticsControlTable.ProdId
{
element.send(_prodBom);
}
}
}
}
return true;
}
The result is that the first page's body section has no data, but the following pages have data in the body, is there any reason why this is happening?
You explicitly calls element.newPage()
before the first send
, which creates a blank page.
A control variable will do the trick:
boolean newPage = false;
...
if (newPage)
element.newPage();
else
newPage = true;