Page 1 of 1

Code Problem with Nubuilder

Posted: Thu Jun 09, 2011 2:03 pm
by at_rcc
Hi friend , why is this code is not working on the report form while the same code works in then database

____________________________________________________________________
$toDate = msql_date_nq('#vTo#');
$fromDate = msql_date_nq('#vFrom#');

//create 1st table
$sql =
<<<EOSQL

CREATE TABLE #dataTable#
SELECT customer_id,cus_code,cus_name,cus_resp_party,cus_phone,cus_mobile,cus_date_created,
'$toDate' as vTo,'$fromDate' as vFrom ,cus_date_created as date_created_cus FROM customer

LEFT JOIN transaction on transaction.tra_customer_id = customer.customer_id
LEFT JOIN transaction_item ON transaction.transaction_id = transaction_item.tri_transaction_id
LEFT JOIN tbl_batch on tbl_batch.batch_id = transaction_item.batch_id

WHERE DATE(cus_date_created) Between '$fromDate' And '$toDate' order by cus_name asc

EOSQL;
nuRunQuery($sql);
_________________________________________________________________________________

CREATE TABLE ___nu14df0b4c7ced1f___ SELECT customer_id,cus_code,cus_name,cus_resp_party,cus_phone,cus_mobile,cus_date_created, '2011-06-09' as vTo,'2010-05-09' as vFrom ,cus_date_created as date_created_cus FROM customer LEFT JOIN transaction on transaction.tra_customer_id = customer.customer_id LEFT JOIN transaction_item ON transaction.transaction_id = transaction_item.tri_transaction_id LEFT JOIN tbl_batch on tbl_batch.batch_id = transaction_item.batch_id WHERE DATE(cus_date_created) Between '2010-05-09' And '2011-06-09' order by cus_name asc

Re: Code Problem with Nubuilder

Posted: Wed Jun 15, 2011 1:43 am
by admin
When nuBuilder creates a report it does so using #dataTable#.

BUT it adds to that table a field for each parameter on the Run Activity Screen (so that they can be used in the report without manually adding them)
Capture2.PNG
So this..
Capture1.PNG
Becomes this..
Capture.png
In your sql query you are naming another field called vFrom and vTo.

I hope this helps

Steven