I have two snippets and both were created based on Community user posts. I am unable to export my data and would like guidance on why this is not working. When I refresh my page it won’t even load the Page!
The reason I’m using a Button is that the default Skuid Export Option is at the bottom of the Page and would like it at the top so users can download and Print the transactions.
I’m using Skuid 15.3.14 Dubai with V1 API
-------------------Version 1:------------------
$ = skuid.$;
var tmodel = skuid.$M(‘Transactions’);
console.log("Model length: ",tmodel.length);
var fields =
tmodel.getField(‘ActivityDate’),
tmodel.getField(‘CheckNum’),
tmodel.getField(‘TransactionType’),
tmodel.getField(‘TransactionDetail’),
tmodel.getField(‘Amount’),
tmodel.getField(‘RunningBalance’)
];
tmodel.exportData({
fileName: ‘Transactions.csv’,
fields: nfields],
doNotAppendRowIdColumn: true
});
-------------------------Version2:-------------------------------------
var params = arguments-0],
$ = skuid.$;
var today = new Date();
var tmodel = skuid.model.getModel(‘Transactions’);
console.log("Number of Rows: ",tmodel.length);
var fields = ,
//use the api names of your fields here
'ActivityDate',
'Checknum',
'TransactionType',
'TransactionDetail',
'Amount',
'RunningBalance'
];
var fieldsWithCorrectLabels = $.map(fields, function(v){
var actualField = tmodel.getField(v);
console.log(actualField.id);
return {
id: actualField.id,
name: actualField.name
};
});
tmodel.exportData({
fileName: ‘Bank Transactions ‘+today+’.csv’,
fields: fieldsWithCorrectLabels,
doNotAppendRowIdColumn: true
});