Skip to main content
Nintex Community Menu Bar
Question

Export Button on V1 Page will not render the Skuid Page


Forum|alt.badge.img+3

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: [fields],
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
});

Translate
Did this topic help you find an answer to your question?

4 replies

Forum|alt.badge.img+17
  • Nintex Employee
  • 3763 replies
  • July 12, 2024

Generally a page that simply wont load means some fatal error in your javascript. A variable that cannot be found etc. Open up the developer console and there will likely be an error posted that will give you insight.

The console log statements in your code are also good checkpoints. If those values are actually generated in the developer console - you know that the code has gotten that far.

Also - is this code included in a resource of type “Inline - Snippet”

Translate

Forum|alt.badge.img+3
  • Author
  • 10 replies
  • July 12, 2024

@Rob_Hatch
I discovered yesterday that when I copied and pasted part of the snippet, it did not work. Then I noticed the parts that I actually wrote were a different color (light green). So, I re-typed the pieces I pasted and behold, it worked. Details…all in the details!!

The above snippet does work now.

Thanks for the response Rob.

Translate

Forum|alt.badge.img+10
  • Scholar
  • 223 replies
  • July 12, 2024

It’s good practice to enclose everything you put inside a javascript snippet in a try catch so that you can see errors in the console properly, otherwise the errors will not display.

for example

try{
$ = 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: [fields],
doNotAppendRowIdColumn: true

});
}catch(e){
console.error(e);
}
Translate

Forum|alt.badge.img+3
  • Author
  • 10 replies
  • July 12, 2024

Mark,

Thank you. I really appreciate you for posting this. I will keep this “tip” and use it in the future.
Steven

Translate

Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie Settings