Page 1 of 1

Trying to build an table report style

PostPosted: Fri Nov 22, 2013 1:59 pm
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.

Re: Trying to build an table report style

PostPosted: Fri Nov 22, 2013 11:08 pm
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):
reportObject.png
"Field" field in report object
reportObject.png (19.66 KiB) Viewed 4546 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:
customReportSection.png
Create a new report section
customReportSection.png (21.68 KiB) Viewed 4546 times

reportObject2.png
Report object in the new section
reportObject2.png (3.31 KiB) Viewed 4546 times


Hope this helps,
Max

Re: Trying to build an table report style

PostPosted: Sat Nov 23, 2013 12:46 am
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..

Re: Trying to build an table report style

PostPosted: Sat Nov 23, 2013 3:14 am
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?
customSection.png
Set height value for custom report section
customSection.png (12.25 KiB) Viewed 4538 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.