Steven,
this is the nuDebug($BP_b4)
Code: Select all
$sql = <<<SQL CREATE TABLE ___nu15087b2f433462___ SELECT * FROM request SQL; nuRunQuery($sql);
The code in BeforeBrowse is:
Code: Select all
$sql = <<<SQL
CREATE TABLE #browseTable#
SELECT * FROM request
SQL;
nuRunQuery($sql);
End identifier in heredoc seems not valutated.
I rewrite the code in this way:
Code: Select all
$sql = "CREATE TABLE #browseTable# SELECT * FROM request ";
nuRunQuery($sql);
and now print button works, but this is on a
simple form: the problem still remain in a
mash subform.
My mash subform has this in SQL field:
Code: Select all
SELECT * FROM #browseTable#
ORDER BY app_date DESC, app_hour DESC
In Before Browse I have this code:
Code: Select all
// Create a temp table with all appointments NOT-CLOSED and add a column with technician names
$sql = "CREATE TABLE #browseTable#";
$sql .= " SELECT * FROM appointment INNER JOIN (request, appointment_status, client)";
$sql .= " ON (app_req_id = req_id AND app_aps_id = aps_id AND req_cli_id = cli_id)";
$sql .= " WHERE app_aps_id <> '1504808820c931' AND app_aps_id <> '1504808787a1a9'";
nuDebug('run1-> '.$sql);
nuRunQuery($sql);
// Add a column to temp table
$sql = "ALTER TABLE #browseTable# ADD tecnici VARCHAR(250) NOT NULL";
nuDebug('run2-> '.$sql);
nuRunQuery($sql);
// Work on temp table
$sql = "SELECT * FROM #browseTable#";
nuDebug('run3-> '.$sql);
$rs = nuRunQuery($sql);
// get technicians related to each appointment
while ($row = db_fetch_object($rs)) {
$appID = $row->app_id; // get appointment ID
$tecnici = getTechnician($appID); // get technician from DB
$tecnici = $tecnici[0]; // get only names
// Update temp table with technician names
$sql = "UPDATE #browseTable# SET tecnici = '".$tecnici."' WHERE app_id = '".$appID."'";
nuDebug('run4-> '.$sql);
nuRunQuery($sql);
}
This is the subform:
mashSubform.png
Now, if I try to print data I get this error:
error.png
If I paste the SQL in phpmyadmin I get:
Code: Select all
#1146 - Table '<dbname>.___nu15087c0ebcdca7___' doesn't exist
If I paste in phpmyadmin all the query captured by nuDebug() functions all work fine: temp table is created and updated correctly:
Code: Select all
(nuBuilder Before Browse) of sfAppXTecnico : run1-> CREATE TABLE ___nu15087f6c1311ca___ SELECT * FROM appointment INNER JOIN (request, appointment_status, client) ON (app_req_id = req_id AND app_aps_id = aps_id AND req_cli_id = cli_id) WHERE app_aps_id <> '1504808820c931' AND app_aps_id <> '1504808787a1a9'
(nuBuilder Before Browse) of sfAppXTecnico : run2-> ALTER TABLE ___nu15087f6c1311ca___ ADD tecnici VARCHAR(250) NOT NULL
Tell me if I can try other solutions.
You do not have the required permissions to view the files attached to this post.