Welcome to the nuBuilder forums!

Please register and login to view forums and other content only available to registered users.

Trying to build an table report style

Post Reply
Ralcala
Posts: 11
Joined: Fri Aug 16, 2013 4:14 pm

Trying to build an table report style

Unread post by Ralcala »

Hi NB Team

i am trying to elaborate a table report and i just got blank spaces

this is my code

nuRunQuery(
<<<EOSQL

CREATE TABLE #dataTable#
SELECT *
FROM an_anticipos
ORDER BY fecha_an
EOSQL
);

$resultSet = nuRunQuery("SELECT * from #dataTable# ");

while ($row = db_fetch_object($resultSet)) {

$fecha_an = $row->fecha_an;
$par_progr_an = $row->par_prog_an;
$par_avance_an = $row->par_avance_an;
$avance_prog_an = $row->avance_prog_an;
$avance_avance_an = $row->avance_avance_an;
$desv_prog_an = $row->desv_prog_an;
$desv_avance_an = $row->desv_avance_an;

//nuRunQuery($s);

}

on Report Writer Detail Block fields name`s are $fecha_an (and the rest of fields) results on blanks and if i switch to fecha_an (and the rest of fields without $) results a data row but not the way i need it cause every row appears on every detail block.

I just want to display all rows on one detail block.

Please any advice or help is appreciated.

Thanks.
massiws
Posts: 503
Joined: Thu May 24, 2012 2:08 am
Location: Milan, Italy
Contact:

Re: Trying to build an table report style

Unread post by massiws »

Ralcala,
nuBuilder report code works on #dataTable# table data: you don't need to execute WHILE() cicle.
To access your data just insert the column name in report objects (without $ sign):
&quot;Field&quot; field in report object
"Field" field in report object
reportObject.png (19.66 KiB) Viewed 9188 times
Ralcala wrote:I just want to display all rows on one detail block.
Do you know the number of rows you get from your query??
If so, you can insert your report objects in a section other than Detail: you can create new custom section clicking on Section/Sort in Report Writer:
Create a new report section
Create a new report section
customReportSection.png (21.68 KiB) Viewed 9188 times
Report object in the new section
Report object in the new section
reportObject2.png (3.31 KiB) Viewed 9188 times
Hope this helps,
Max
Ralcala
Posts: 11
Joined: Fri Aug 16, 2013 4:14 pm

Re: Trying to build an table report style

Unread post by Ralcala »

Hi Max thank you for your answer

i do what you tell me but i got blue screen of death nb every time i try to run the report here is the report code
simplified..

$s = "CREATE TABLE #dataTable# ";
$s .= "SELECT * FROM an_anticipos ";
$s .= "ORDER BY fecha_an";
nuRunQuery($s);

and in the Report body i inserted a new section as you guide me and create a new object for the field but nothing happens

BTW if a put it back to Detail section it works… and the ____nu*********_____ table that make every time got an error browsing it show table data but i dont know whats going on...

As you noted i am a newbie on NB world sorry for bother you with my newbieness..
massiws
Posts: 503
Joined: Thu May 24, 2012 2:08 am
Location: Milan, Italy
Contact:

Re: Trying to build an table report style

Unread post by massiws »

Ralcala,
my first question is: how many rows you get from your query?
If you get more then one row, you MUST insert your objects in Detail section, to make nuBuilder print them; alternatively, you can modify #dataTable# as you want in your code (for example, executing ALTER TABLE queries) to obtain only one row in #dataTable#.

Furthermore, the new report section you created have a height value?
Set height value for custom report section
Set height value for custom report section
customSection.png (12.25 KiB) Viewed 9180 times
But, first of all, try to insert a nuDebug() function before nuRunQuery():

Code: Select all

nuDebug($s); // you can inspect the real query sent to MySQL in Setup -> Debug (or zzsys_trap table in phpmyadmin)
nuRunQuery($s); 
then try to copy/paste the query in phpmyadmin to make sure syntax is correct.
Post Reply