From the FormEdit screen, I'm trying to export a subform data to CSV.
I created some PHP code to query the subform records (not sure if that's necessary since the values are available in the FORM data).
What's the best way to achieve this?
Your CSV code puts the Temporary Table name into zzzsys_debug.deb_message->records, how can I do the same, if this is the way to go?
My PHP Code (name:ExportRegisters):
Code: Select all
$sql = "
CREATE TABLE #TABLE_ID#
SELECT FeeAmount as Amount,FeeCurrency as Currency, FeeType as `Type`,Memo,Rate, FeeDate as `Date`, Teller as `User`
FROM VaultFees WHERE vault_id = '#RECORD_ID#'
";
nuRunQuery($sql);
Am I close?
Code: Select all
var P = new nuCopyJSObject(nuFORM);
P.call_type = 'runphp';
P.parent_record_id = 'ExportRegisters';
P.form_data = nuGetData();
var request = $.ajax({
url : "nuapi.php",
type : "POST",
data : {nuWindow : P},
async : false,
success : function(data) {
var obj = $.parseJSON(data.DATA);
window.open('bitexport.php?i='+obj.id); //php page very similar to CSV code
},
dataType : "json"
}).done(function(data){
if(nuErrorMessage(data.ERRORS)){return;}
});