Servoy Methods Details |
---|
getArray
Array<Array<Object>> getArray( String )
Read a QuickBooks export contact file and return a 2D Array. The showHeader parameter defaults to true.Parameters
String filePath the file path
Returns
Array<Array<Object>> array Object[][]
Supported Clients
SmartClient, WebClient, NGClient
Sample
// Read a QuickBooks export contact file and return a 2D Array. The showHeader parameter defaults to true.
// Set the name of the file
// We are going to import a contact file. The import method is basically the same for contact, customer, employee en vendor
// The format is based on the headers exported with the file.
var filePath = plugins.file.showFileOpenDialog();
// Check that we really selected a file
// if not ignore the rest of the code
if (filePath) {
var set = null;
var contact = plugins.it2be_data.qbcontact();
//The reader will pick up the right fileformat based on the extension
//extensions/filetimes can be .txt, .csv or .xls
//Create a dataset from the file
//The showHeader parameter is set to false by default
//REMARK: a header will always be constructed from the first row
set = contact.getDataSet(filePath);
//When the dataset is NOT empty
if (set.getMaxRowIndex()) {
//Create a header array (just because we can)
var header = new Array();
for (var i = 1 ; i < set.getMaxColumnIndex() ; i++) {
header[i - 1] = set.getColumnName(i);
}
application.output(header.join(","));
//Create a HTML message to show in the browser
var message = set.getAsHTML();
//When the message is not empty
if (message) {
//Get the name of the operating system
var osname = application.getOSName();
var filePath = "IDQbContact.html";
//Write the file into the home directory
var result = plugins.file.writeTXTFile(filePath, message);
//When the file is acually written
if (result) {
//open the html in your default browser
//checking the os needs to be done via evaluation of a string
//you can also use the tools plugin that will give you an integer
if (osname.indexOf("Mac") > -1) {
//mac os x
application.executeProgram("open", filePath);
} else if (osname.indexOf("Windows") > -1) {
//windows
application.executeProgram("rundll32", "url.dll,FileProtocolHandler", filePath);
} else {
//linux etc. would love to know how to do this!
}
}
}
} else {
//output to the debugger to show there is NO result
application.output("JSDataSet = null");
}
}
getArray
Array<Array<Object>> getArray( String, Boolean )
Read a QuickBooks export contact file and return a 2D Array. The showHeader parameter defaults to true.Parameters
String filePath the file path
Boolean showHeader the show header
Returns
Array<Array<Object>> array Object[][]
Supported Clients
SmartClient, WebClient, NGClient
Sample
// Read a QuickBooks export contact file and return a 2D Array. The showHeader parameter defaults to true.
// Set the name of the file
// We are going to import a contact file. The import method is basically the same for contact, customer, employee en vendor
// The format is based on the headers exported with the file.
var filePath = plugins.file.showFileOpenDialog();
// Check that we really selected a file
// if not ignore the rest of the code
if (filePath) {
var set = null;
var contact = plugins.it2be_data.qbcontact();
//The reader will pick up the right fileformat based on the extension
//extensions/filetimes can be .txt, .csv or .xls
//Create a dataset from the file
//The showHeader parameter is set to false by default
//REMARK: a header will always be constructed from the first row
set = contact.getDataSet(filePath);
//When the dataset is NOT empty
if (set.getMaxRowIndex()) {
//Create a header array (just because we can)
var header = new Array();
for (var i = 1 ; i < set.getMaxColumnIndex() ; i++) {
header[i - 1] = set.getColumnName(i);
}
application.output(header.join(","));
//Create a HTML message to show in the browser
var message = set.getAsHTML();
//When the message is not empty
if (message) {
//Get the name of the operating system
var osname = application.getOSName();
var filePath = "IDQbContact.html";
//Write the file into the home directory
var result = plugins.file.writeTXTFile(filePath, message);
//When the file is acually written
if (result) {
//open the html in your default browser
//checking the os needs to be done via evaluation of a string
//you can also use the tools plugin that will give you an integer
if (osname.indexOf("Mac") > -1) {
//mac os x
application.executeProgram("open", filePath);
} else if (osname.indexOf("Windows") > -1) {
//windows
application.executeProgram("rundll32", "url.dll,FileProtocolHandler", filePath);
} else {
//linux etc. would love to know how to do this!
}
}
}
} else {
//output to the debugger to show there is NO result
application.output("JSDataSet = null");
}
}
getContactHeader
Array<Object> getContactHeader( )
Retrieve an array of headers for the customer .txt file.Returns
Array<Object> header Object[]
Supported Clients
SmartClient, WebClient, NGClient
Sample
// Retrieve an array of headers for the customer .txt file.
var contact = plugins.it2be_data.qbcontact();
var message_contact = contact.getContactHeader();
var message_customer = contact.getCustomerHeader();
var message_employee = contact.getEmployeeHeader();
var message_vendor = contact.getVendorHeader();
// plugins.dialogs.showInfoDialog("info", message_contact);
plugins.dialogs.showInfoDialog("info", message_customer);
// plugins.dialogs.showInfoDialog("info", message_employee);
// plugins.dialogs.showInfoDialog("info", message_vendor);
getCustomerHeader
Array<Object> getCustomerHeader( )
Retrieve an array of headers for the customer .csv or .xls file.Returns
Array<Object> header Object[]
Supported Clients
SmartClient, WebClient, NGClient
Sample
// Retrieve an array of headers for the customer .csv or .xls file.
var contact = plugins.it2be_data.qbcontact();
var message_contact = contact.getContactHeader();
var message_customer = contact.getCustomerHeader();
var message_employee = contact.getEmployeeHeader();
var message_vendor = contact.getVendorHeader();
// plugins.dialogs.showInfoDialog("info", message_contact);
plugins.dialogs.showInfoDialog("info", message_customer);
// plugins.dialogs.showInfoDialog("info", message_employee);
// plugins.dialogs.showInfoDialog("info", message_vendor);
getDataSet
JSDataSet getDataSet( String, Boolean )
Read a QuickBooks export contact file and return a JSDataSet. The showHeader parameter defaults to false.Parameters
String filePath the file path
Boolean showHeader the show header
Returns
JSDataSet JSDataSet
Supported Clients
SmartClient, WebClient, NGClient
Sample
// Read a QuickBooks export contact file and return a JSDataSet. The showHeader parameter defaults to false.
// Set the name of the file
// We are going to import a contact file. The import method is basically the same for contact, customer, employee en vendor
// The format is based on the headers exported with the file.
var filePath = plugins.file.showFileOpenDialog();
// Check that we really selected a file
// if not ignore the rest of the code
if (filePath) {
var set = null;
var contact = plugins.it2be_data.qbcontact();
//The reader will pick up the right fileformat based on the extension
//extensions/filetimes can be .txt, .csv or .xls
//Create a dataset from the file
//The showHeader parameter is set to false by default
//REMARK: a header will always be constructed from the first row
set = contact.getDataSet(filePath);
//When the dataset is NOT empty
if (set.getMaxRowIndex()) {
//Create a header array (just because we can)
var header = new Array();
for (var i = 1 ; i < set.getMaxColumnIndex() ; i++) {
header[i - 1] = set.getColumnName(i);
}
application.output(header.join(","));
//Create a HTML message to show in the browser
var message = set.getAsHTML();
//When the message is not empty
if (message) {
//Get the name of the operating system
var osname = application.getOSName();
var filePath = "IDQbContact.html";
//Write the file into the home directory
var result = plugins.file.writeTXTFile(filePath, message);
//When the file is acually written
if (result) {
//open the html in your default browser
//checking the os needs to be done via evaluation of a string
//you can also use the tools plugin that will give you an integer
if (osname.indexOf("Mac") > -1) {
//mac os x
application.executeProgram("open", filePath);
} else if (osname.indexOf("Windows") > -1) {
//windows
application.executeProgram("rundll32", "url.dll,FileProtocolHandler", filePath);
} else {
//linux etc. would love to know how to do this!
}
}
}
} else {
//output to the debugger to show there is NO result
application.output("JSDataSet = null");
}
}
getDataSet
JSDataSet getDataSet( String )
Read a QuickBooks export contact file and return a JSDataSet. The showHeader parameter defaults to false.Parameters
String filePath the file path
Returns
JSDataSet set JSDataSet
Supported Clients
SmartClient, WebClient, NGClient
Sample
// Read a QuickBooks export contact file and return a JSDataSet. The showHeader parameter defaults to false.
// Set the name of the file
// We are going to import a contact file. The import method is basically the same for contact, customer, employee en vendor
// The format is based on the headers exported with the file.
var filePath = plugins.file.showFileOpenDialog();
// Check that we really selected a file
// if not ignore the rest of the code
if (filePath) {
var set = null;
var contact = plugins.it2be_data.qbcontact();
//The reader will pick up the right fileformat based on the extension
//extensions/filetimes can be .txt, .csv or .xls
//Create a dataset from the file
//The showHeader parameter is set to false by default
//REMARK: a header will always be constructed from the first row
set = contact.getDataSet(filePath);
//When the dataset is NOT empty
if (set.getMaxRowIndex()) {
//Create a header array (just because we can)
var header = new Array();
for (var i = 1 ; i < set.getMaxColumnIndex() ; i++) {
header[i - 1] = set.getColumnName(i);
}
application.output(header.join(","));
//Create a HTML message to show in the browser
var message = set.getAsHTML();
//When the message is not empty
if (message) {
//Get the name of the operating system
var osname = application.getOSName();
var filePath = "IDQbContact.html";
//Write the file into the home directory
var result = plugins.file.writeTXTFile(filePath, message);
//When the file is acually written
if (result) {
//open the html in your default browser
//checking the os needs to be done via evaluation of a string
//you can also use the tools plugin that will give you an integer
if (osname.indexOf("Mac") > -1) {
//mac os x
application.executeProgram("open", filePath);
} else if (osname.indexOf("Windows") > -1) {
//windows
application.executeProgram("rundll32", "url.dll,FileProtocolHandler", filePath);
} else {
//linux etc. would love to know how to do this!
}
}
}
} else {
//output to the debugger to show there is NO result
application.output("JSDataSet = null");
}
}
getEmployeeHeader
Array<Object> getEmployeeHeader( )
Retrieve an array of headers for the employee .csv or .xls file.Returns
Array<Object> header Object[]
Supported Clients
SmartClient, WebClient, NGClient
Sample
// Retrieve an array of headers for the employee .csv or .xls file.
var contact = plugins.it2be_data.qbcontact();
var message_contact = contact.getContactHeader();
var message_customer = contact.getCustomerHeader();
var message_employee = contact.getEmployeeHeader();
var message_vendor = contact.getVendorHeader();
// plugins.dialogs.showInfoDialog("info", message_contact);
plugins.dialogs.showInfoDialog("info", message_customer);
// plugins.dialogs.showInfoDialog("info", message_employee);
// plugins.dialogs.showInfoDialog("info", message_vendor);
getVendorHeader
Array<Object> getVendorHeader( )
Retrieve an array of headers for the vendor .csv or .xls file.Returns
Array<Object> header Object[]
Supported Clients
SmartClient, WebClient, NGClient
Sample
// Retrieve an array of headers for the vendor .csv or .xls file.
var contact = plugins.it2be_data.qbcontact();
var message_contact = contact.getContactHeader();
var message_customer = contact.getCustomerHeader();
var message_employee = contact.getEmployeeHeader();
var message_vendor = contact.getVendorHeader();
// plugins.dialogs.showInfoDialog("info", message_contact);
plugins.dialogs.showInfoDialog("info", message_customer);
// plugins.dialogs.showInfoDialog("info", message_employee);
// plugins.dialogs.showInfoDialog("info", message_vendor);
writeContact
String writeContact( String, Array<Array<Object>> )
Write a QuickBooks import contact fileParameters
String filePath the file path
Array<Array<Object>> set Object[][]
Returns
String fileName String
Supported Clients
SmartClient, WebClient, NGClient
Sample
// Write a QuickBooks import contact file
// The customer and employee format follows the QuickBooks field order.
// The employee and contact format are based on the QuickBook export files. There are no 'standard' contact and employee imports.
// Get a dataset based on a query on the example (crm) database (companies/contacts) tables
// By adding the empty values ('') you can create a dataset that goes right into the file
// There is need to add empty values at the end. The plug-in will finish the the row for you.
var query = "SELECT '',c.firstname,'',c.surname,o.company_name" +
" FROM contacts AS c, companies AS o" +
" WHERE c.company_id=o.companiesid";
var dataset = databaseManager.getDataSetByQuery(controller.getServerName(), query, null, 1000);
// stop executing this method when the dataset is empty
// and show an error dialog
if (!dataset.getMaxRowIndex()) {
plugins.dialogs.showErrorDialog("Error.", "There are no records!", "OK");
Return;
}
// set the name of the file
// when no extension is set it will be .txt by default
var filePath = plugins.file.showFileSaveDialog();
// get the name of the operating system to know how to execute the,
// to the filetype attached,application
var osname = application.getOSName();
// check that we really selected a file
// if not ignore the rest of the code
if (filePath) {
var contact = plugins.it2be_data.qbcontact();
//we can use either a 2D array or a dataset for input
//you would typically use a 2D array from data you can not retrieve from the database
//in the below example we will create a 2D array from a dataset
//just to show you how to do it
//var selection = new Array();
//
//for (var i = 1 ; i <= dataset.getMaxRowIndex() ; i++) {
// var row = dataset.getRowAsArray(i);
//
// selection[i - 1] = row;
//}
//write the file
//filePath = contact.writeContact(filePath, selection);
//we won't use the 'selection' array since a dataset can be used without creating an array
filePath = contact.writeContact(filePath, dataset);
//open the data in the (to the filetype attached) application
//checking the os needs to be done via evaluation of a string
//you can also use the tools plugin that will give you an integer
if (osname.indexOf("Mac") > -1) {
//mac os x
application.executeProgram("open", filePath);
} else if (osname.indexOf("Windows") > -1) {
//windows
application.executeProgram("rundll32", "url.dll,FileProtocolHandler", filePath);
} else {
//linux etc. would love to know how to do this!
}
}
// Fields in QuickBooks import order
// Salution
// First Name
// Middle Initial
// Last Name
// Company Name
// City
// State
// Zip
// Country
// Contact
// Alternate Contact
// Address 1
// Address 2
// Address 3
// Address 4
// Shipping Address 1
// Shipping Address 2
// Shipping Address 3
// Shipping Address 4
// Shipping City
// Shipping State
// Shipping Zip
// Shipping Country
writeContact
String writeContact( String, Object )
Write a QuickBooks import contact fileParameters
String filePath the file path
Object set JSDataSet or Object[]
Returns
String fileName String
Supported Clients
SmartClient, WebClient, NGClient
Sample
// Write a QuickBooks import contact file
// The customer and employee format follows the QuickBooks field order.
// The employee and contact format are based on the QuickBook export files. There are no 'standard' contact and employee imports.
// Get a dataset based on a query on the example (crm) database (companies/contacts) tables
// By adding the empty values ('') you can create a dataset that goes right into the file
// There is need to add empty values at the end. The plug-in will finish the the row for you.
var query = "SELECT '',c.firstname,'',c.surname,o.company_name" +
" FROM contacts AS c, companies AS o" +
" WHERE c.company_id=o.companiesid";
var dataset = databaseManager.getDataSetByQuery(controller.getServerName(), query, null, 1000);
// stop executing this method when the dataset is empty
// and show an error dialog
if (!dataset.getMaxRowIndex()) {
plugins.dialogs.showErrorDialog("Error.", "There are no records!", "OK");
Return;
}
// set the name of the file
// when no extension is set it will be .txt by default
var filePath = plugins.file.showFileSaveDialog();
// get the name of the operating system to know how to execute the,
// to the filetype attached,application
var osname = application.getOSName();
// check that we really selected a file
// if not ignore the rest of the code
if (filePath) {
var contact = plugins.it2be_data.qbcontact();
//we can use either a 2D array or a dataset for input
//you would typically use a 2D array from data you can not retrieve from the database
//in the below example we will create a 2D array from a dataset
//just to show you how to do it
//var selection = new Array();
//
//for (var i = 1 ; i <= dataset.getMaxRowIndex() ; i++) {
// var row = dataset.getRowAsArray(i);
//
// selection[i - 1] = row;
//}
//write the file
//filePath = contact.writeContact(filePath, selection);
//we won't use the 'selection' array since a dataset can be used without creating an array
filePath = contact.writeContact(filePath, dataset);
//open the data in the (to the filetype attached) application
//checking the os needs to be done via evaluation of a string
//you can also use the tools plugin that will give you an integer
if (osname.indexOf("Mac") > -1) {
//mac os x
application.executeProgram("open", filePath);
} else if (osname.indexOf("Windows") > -1) {
//windows
application.executeProgram("rundll32", "url.dll,FileProtocolHandler", filePath);
} else {
//linux etc. would love to know how to do this!
}
}
// Fields in QuickBooks import order
// Salution
// First Name
// Middle Initial
// Last Name
// Company Name
// City
// State
// Zip
// Country
// Contact
// Alternate Contact
// Address 1
// Address 2
// Address 3
// Address 4
// Shipping Address 1
// Shipping Address 2
// Shipping Address 3
// Shipping Address 4
// Shipping City
// Shipping State
// Shipping Zip
// Shipping Country
writeContact
String writeContact( String, Array<Array<Object>>, Boolean )
Write a QuickBooks import contact fileParameters
String filePath the file path
Array<Array<Object>> set Object[][]
Boolean overwrite the overwrite
Returns
String fileName String
Supported Clients
SmartClient, WebClient, NGClient
Sample
// Write a QuickBooks import contact file
// The customer and employee format follows the QuickBooks field order.
// The employee and contact format are based on the QuickBook export files. There are no 'standard' contact and employee imports.
// Get a dataset based on a query on the example (crm) database (companies/contacts) tables
// By adding the empty values ('') you can create a dataset that goes right into the file
// There is need to add empty values at the end. The plug-in will finish the the row for you.
var query = "SELECT '',c.firstname,'',c.surname,o.company_name" +
" FROM contacts AS c, companies AS o" +
" WHERE c.company_id=o.companiesid";
var dataset = databaseManager.getDataSetByQuery(controller.getServerName(), query, null, 1000);
// stop executing this method when the dataset is empty
// and show an error dialog
if (!dataset.getMaxRowIndex()) {
plugins.dialogs.showErrorDialog("Error.", "There are no records!", "OK");
Return;
}
// set the name of the file
// when no extension is set it will be .txt by default
var filePath = plugins.file.showFileSaveDialog();
// get the name of the operating system to know how to execute the,
// to the filetype attached,application
var osname = application.getOSName();
// check that we really selected a file
// if not ignore the rest of the code
if (filePath) {
var contact = plugins.it2be_data.qbcontact();
//we can use either a 2D array or a dataset for input
//you would typically use a 2D array from data you can not retrieve from the database
//in the below example we will create a 2D array from a dataset
//just to show you how to do it
//var selection = new Array();
//
//for (var i = 1 ; i <= dataset.getMaxRowIndex() ; i++) {
// var row = dataset.getRowAsArray(i);
//
// selection[i - 1] = row;
//}
//write the file
//filePath = contact.writeContact(filePath, selection);
//we won't use the 'selection' array since a dataset can be used without creating an array
filePath = contact.writeContact(filePath, dataset);
//open the data in the (to the filetype attached) application
//checking the os needs to be done via evaluation of a string
//you can also use the tools plugin that will give you an integer
if (osname.indexOf("Mac") > -1) {
//mac os x
application.executeProgram("open", filePath);
} else if (osname.indexOf("Windows") > -1) {
//windows
application.executeProgram("rundll32", "url.dll,FileProtocolHandler", filePath);
} else {
//linux etc. would love to know how to do this!
}
}
// Fields in QuickBooks import order
// Salution
// First Name
// Middle Initial
// Last Name
// Company Name
// City
// State
// Zip
// Country
// Contact
// Alternate Contact
// Address 1
// Address 2
// Address 3
// Address 4
// Shipping Address 1
// Shipping Address 2
// Shipping Address 3
// Shipping Address 4
// Shipping City
// Shipping State
// Shipping Zip
// Shipping Country
writeContact
String writeContact( String, Object, Boolean )
Write a QuickBooks import contact fileParameters
String filePath the file path
Object set JSDataSet or Object[]
Boolean overwrite the overwrite
Returns
String fileName String
Supported Clients
SmartClient, WebClient, NGClient
Sample
// Write a QuickBooks import contact file
// The customer and employee format follows the QuickBooks field order.
// The employee and contact format are based on the QuickBook export files. There are no 'standard' contact and employee imports.
// Get a dataset based on a query on the example (crm) database (companies/contacts) tables
// By adding the empty values ('') you can create a dataset that goes right into the file
// There is need to add empty values at the end. The plug-in will finish the the row for you.
var query = "SELECT '',c.firstname,'',c.surname,o.company_name" +
" FROM contacts AS c, companies AS o" +
" WHERE c.company_id=o.companiesid";
var dataset = databaseManager.getDataSetByQuery(controller.getServerName(), query, null, 1000);
// stop executing this method when the dataset is empty
// and show an error dialog
if (!dataset.getMaxRowIndex()) {
plugins.dialogs.showErrorDialog("Error.", "There are no records!", "OK");
Return;
}
// set the name of the file
// when no extension is set it will be .txt by default
var filePath = plugins.file.showFileSaveDialog();
// get the name of the operating system to know how to execute the,
// to the filetype attached,application
var osname = application.getOSName();
// check that we really selected a file
// if not ignore the rest of the code
if (filePath) {
var contact = plugins.it2be_data.qbcontact();
//we can use either a 2D array or a dataset for input
//you would typically use a 2D array from data you can not retrieve from the database
//in the below example we will create a 2D array from a dataset
//just to show you how to do it
//var selection = new Array();
//
//for (var i = 1 ; i <= dataset.getMaxRowIndex() ; i++) {
// var row = dataset.getRowAsArray(i);
//
// selection[i - 1] = row;
//}
//write the file
//filePath = contact.writeContact(filePath, selection);
//we won't use the 'selection' array since a dataset can be used without creating an array
filePath = contact.writeContact(filePath, dataset);
//open the data in the (to the filetype attached) application
//checking the os needs to be done via evaluation of a string
//you can also use the tools plugin that will give you an integer
if (osname.indexOf("Mac") > -1) {
//mac os x
application.executeProgram("open", filePath);
} else if (osname.indexOf("Windows") > -1) {
//windows
application.executeProgram("rundll32", "url.dll,FileProtocolHandler", filePath);
} else {
//linux etc. would love to know how to do this!
}
}
// Fields in QuickBooks import order
// Salution
// First Name
// Middle Initial
// Last Name
// Company Name
// City
// State
// Zip
// Country
// Contact
// Alternate Contact
// Address 1
// Address 2
// Address 3
// Address 4
// Shipping Address 1
// Shipping Address 2
// Shipping Address 3
// Shipping Address 4
// Shipping City
// Shipping State
// Shipping Zip
// Shipping Country
writeCustomer
String writeCustomer( String, Array<Array<Object>>, Boolean )
Write a QuickBooks import customer fileParameters
String filePath the file path
Array<Array<Object>> set Object[][]
Boolean overwrite the overwrite
Returns
String fileName String
Supported Clients
SmartClient, WebClient, NGClient
writeCustomer
String writeCustomer( String, Object, Boolean )
Write a QuickBooks import customer fileParameters
String filePath the file path
Object set JSDataSet or Object[]
Boolean overwrite the overwrite
Returns
String fileName String
Supported Clients
SmartClient, WebClient, NGClient
writeCustomer
String writeCustomer( String, Array<Array<Object>> )
Write a QuickBooks import customer fileParameters
String filePath the file path
Array<Array<Object>> set Object[][]
Returns
String fileName String
Supported Clients
SmartClient, WebClient, NGClient
writeEmployee
String writeEmployee( String, Object )
Write a QuickBooks import employee fileParameters
String filePath the file path
Object set JSDataSet or Object[]
Returns
String fileName String
Supported Clients
SmartClient, WebClient, NGClient
Sample
// Write a QuickBooks import employee file
// The customer and employee format follows the QuickBooks field order.
// The employee and contact format are based on the QuickBook export files. There are no 'standard' contact and employee imports.
// Get a dataset based on a query on the example (crm) database (companies/contacts) tables
// By adding the empty values ('') you can create a dataset that goes right into the file
// There is need to add empty values at the end. The plug-in will finish the the row for you.
var input = [yourcompanyid];
var query = "SELECT c.surname,c.firstname+''+c.surname" +
" FROM contacts AS c" +
" WHERE c.company_id=?";
var dataset = databaseManager.getDataSetByQuery(controller.getServerName(), query, input, 1000);
// stop executing this method when the dataset is empty
// and show an error dialog
if (!dataset.getMaxRowIndex()) {
plugins.dialogs.showErrorDialog("Error.", "There are no records!", "OK");
Return;
}
// set the name of the file
// when no extension is set it will be .txt by default
var filePath = plugins.file.showFileSaveDialog();
// get the name of the operating system to know how to execute the,
// to the filetype attached,application
var osname = application.getOSName();
// check that we really selected a file
// if not ignore the rest of the code
if (filePath) {
var contact = plugins.it2be_data.qbcontact();
//we can use either a 2D array or a dataset for input
//you would typically use a 2D array from data you can not retrieve from the database
//in the below example we will create a 2D array from a dataset
//just to show you how to do it
//var selection = new Array();
//
//for (var i = 1 ; i <= dataset.getMaxRowIndex() ; i++) {
// var row = dataset.getRowAsArray(i);
//
// selection[i - 1] = row;
//}
//write the file
//filePath = contact.writeEmployee(filePath, selection);
//we won't use the 'selection' array since a dataset can be used without creating an array
filePath = contact.writeEmployee(filePath, dataset);
//open the data in the (to the filetype attached) application
//checking the os needs to be done via evaluation of a string
//you can also use the tools plugin that will give you an integer
if (osname.indexOf("Mac") > -1) {
//mac os x
application.executeProgram("open", filePath);
} else if (osname.indexOf("Windows") > -1) {
//windows
application.executeProgram("rundll32", "url.dll,FileProtocolHandler", filePath);
} else {
//linux etc. would love to know how to do this!
}
}
// Fields in QuickBooks import order
// empty
// Employee
// Has notes
// Salution
// Phone
// Alternate Phone
// SS Number
// Address
// City
// State
// Zip
// Email
// Date of Birth
// Cellular
// Pager
// Fax
// PIN (Pager)
writeEmployee
String writeEmployee( String, Object, Boolean )
Write a QuickBooks import employee fileParameters
String filePath the file path
Object set JSDataSet or Object[]
Boolean overwrite the overwrite
Returns
String fileName String
Supported Clients
SmartClient, WebClient, NGClient
Sample
// Write a QuickBooks import employee file
// The customer and employee format follows the QuickBooks field order.
// The employee and contact format are based on the QuickBook export files. There are no 'standard' contact and employee imports.
// Get a dataset based on a query on the example (crm) database (companies/contacts) tables
// By adding the empty values ('') you can create a dataset that goes right into the file
// There is need to add empty values at the end. The plug-in will finish the the row for you.
var input = [yourcompanyid];
var query = "SELECT c.surname,c.firstname+''+c.surname" +
" FROM contacts AS c" +
" WHERE c.company_id=?";
var dataset = databaseManager.getDataSetByQuery(controller.getServerName(), query, input, 1000);
// stop executing this method when the dataset is empty
// and show an error dialog
if (!dataset.getMaxRowIndex()) {
plugins.dialogs.showErrorDialog("Error.", "There are no records!", "OK");
Return;
}
// set the name of the file
// when no extension is set it will be .txt by default
var filePath = plugins.file.showFileSaveDialog();
// get the name of the operating system to know how to execute the,
// to the filetype attached,application
var osname = application.getOSName();
// check that we really selected a file
// if not ignore the rest of the code
if (filePath) {
var contact = plugins.it2be_data.qbcontact();
//we can use either a 2D array or a dataset for input
//you would typically use a 2D array from data you can not retrieve from the database
//in the below example we will create a 2D array from a dataset
//just to show you how to do it
//var selection = new Array();
//
//for (var i = 1 ; i <= dataset.getMaxRowIndex() ; i++) {
// var row = dataset.getRowAsArray(i);
//
// selection[i - 1] = row;
//}
//write the file
//filePath = contact.writeEmployee(filePath, selection);
//we won't use the 'selection' array since a dataset can be used without creating an array
filePath = contact.writeEmployee(filePath, dataset);
//open the data in the (to the filetype attached) application
//checking the os needs to be done via evaluation of a string
//you can also use the tools plugin that will give you an integer
if (osname.indexOf("Mac") > -1) {
//mac os x
application.executeProgram("open", filePath);
} else if (osname.indexOf("Windows") > -1) {
//windows
application.executeProgram("rundll32", "url.dll,FileProtocolHandler", filePath);
} else {
//linux etc. would love to know how to do this!
}
}
// Fields in QuickBooks import order
// empty
// Employee
// Has notes
// Salution
// Phone
// Alternate Phone
// SS Number
// Address
// City
// State
// Zip
// Email
// Date of Birth
// Cellular
// Pager
// Fax
// PIN (Pager)
writeEmployee
String writeEmployee( String, Array<Array<Object>> )
Write a QuickBooks import employee fileParameters
String filePath the file path
Array<Array<Object>> set Object[][]
Returns
String fileName String
Supported Clients
SmartClient, WebClient, NGClient
Sample
// Write a QuickBooks import employee file
// The customer and employee format follows the QuickBooks field order.
// The employee and contact format are based on the QuickBook export files. There are no 'standard' contact and employee imports.
// Get a dataset based on a query on the example (crm) database (companies/contacts) tables
// By adding the empty values ('') you can create a dataset that goes right into the file
// There is need to add empty values at the end. The plug-in will finish the the row for you.
var input = [yourcompanyid];
var query = "SELECT c.surname,c.firstname+''+c.surname" +
" FROM contacts AS c" +
" WHERE c.company_id=?";
var dataset = databaseManager.getDataSetByQuery(controller.getServerName(), query, input, 1000);
// stop executing this method when the dataset is empty
// and show an error dialog
if (!dataset.getMaxRowIndex()) {
plugins.dialogs.showErrorDialog("Error.", "There are no records!", "OK");
Return;
}
// set the name of the file
// when no extension is set it will be .txt by default
var filePath = plugins.file.showFileSaveDialog();
// get the name of the operating system to know how to execute the,
// to the filetype attached,application
var osname = application.getOSName();
// check that we really selected a file
// if not ignore the rest of the code
if (filePath) {
var contact = plugins.it2be_data.qbcontact();
//we can use either a 2D array or a dataset for input
//you would typically use a 2D array from data you can not retrieve from the database
//in the below example we will create a 2D array from a dataset
//just to show you how to do it
//var selection = new Array();
//
//for (var i = 1 ; i <= dataset.getMaxRowIndex() ; i++) {
// var row = dataset.getRowAsArray(i);
//
// selection[i - 1] = row;
//}
//write the file
//filePath = contact.writeEmployee(filePath, selection);
//we won't use the 'selection' array since a dataset can be used without creating an array
filePath = contact.writeEmployee(filePath, dataset);
//open the data in the (to the filetype attached) application
//checking the os needs to be done via evaluation of a string
//you can also use the tools plugin that will give you an integer
if (osname.indexOf("Mac") > -1) {
//mac os x
application.executeProgram("open", filePath);
} else if (osname.indexOf("Windows") > -1) {
//windows
application.executeProgram("rundll32", "url.dll,FileProtocolHandler", filePath);
} else {
//linux etc. would love to know how to do this!
}
}
// Fields in QuickBooks import order
// empty
// Employee
// Has notes
// Salution
// Phone
// Alternate Phone
// SS Number
// Address
// City
// State
// Zip
// Email
// Date of Birth
// Cellular
// Pager
// Fax
// PIN (Pager)
writeEmployee
String writeEmployee( String, Array<Array<Object>>, Boolean )
Write a QuickBooks import employee fileParameters
String filePath the file path
Array<Array<Object>> set Object[][]
Boolean overwrite the overwrite
Returns
String fileName String
Supported Clients
SmartClient, WebClient, NGClient
Sample
// Write a QuickBooks import employee file
// The customer and employee format follows the QuickBooks field order.
// The employee and contact format are based on the QuickBook export files. There are no 'standard' contact and employee imports.
// Get a dataset based on a query on the example (crm) database (companies/contacts) tables
// By adding the empty values ('') you can create a dataset that goes right into the file
// There is need to add empty values at the end. The plug-in will finish the the row for you.
var input = [yourcompanyid];
var query = "SELECT c.surname,c.firstname+''+c.surname" +
" FROM contacts AS c" +
" WHERE c.company_id=?";
var dataset = databaseManager.getDataSetByQuery(controller.getServerName(), query, input, 1000);
// stop executing this method when the dataset is empty
// and show an error dialog
if (!dataset.getMaxRowIndex()) {
plugins.dialogs.showErrorDialog("Error.", "There are no records!", "OK");
Return;
}
// set the name of the file
// when no extension is set it will be .txt by default
var filePath = plugins.file.showFileSaveDialog();
// get the name of the operating system to know how to execute the,
// to the filetype attached,application
var osname = application.getOSName();
// check that we really selected a file
// if not ignore the rest of the code
if (filePath) {
var contact = plugins.it2be_data.qbcontact();
//we can use either a 2D array or a dataset for input
//you would typically use a 2D array from data you can not retrieve from the database
//in the below example we will create a 2D array from a dataset
//just to show you how to do it
//var selection = new Array();
//
//for (var i = 1 ; i <= dataset.getMaxRowIndex() ; i++) {
// var row = dataset.getRowAsArray(i);
//
// selection[i - 1] = row;
//}
//write the file
//filePath = contact.writeEmployee(filePath, selection);
//we won't use the 'selection' array since a dataset can be used without creating an array
filePath = contact.writeEmployee(filePath, dataset);
//open the data in the (to the filetype attached) application
//checking the os needs to be done via evaluation of a string
//you can also use the tools plugin that will give you an integer
if (osname.indexOf("Mac") > -1) {
//mac os x
application.executeProgram("open", filePath);
} else if (osname.indexOf("Windows") > -1) {
//windows
application.executeProgram("rundll32", "url.dll,FileProtocolHandler", filePath);
} else {
//linux etc. would love to know how to do this!
}
}
// Fields in QuickBooks import order
// empty
// Employee
// Has notes
// Salution
// Phone
// Alternate Phone
// SS Number
// Address
// City
// State
// Zip
// Email
// Date of Birth
// Cellular
// Pager
// Fax
// PIN (Pager)
writeVendor
String writeVendor( String, Object, Boolean )
Write a QuickBooks import vendor fileParameters
String filePath the file path
Object set JSDataSet or Object[]
Boolean overwrite the overwrite
Returns
String fileName String
Supported Clients
SmartClient, WebClient, NGClient
Sample
// Write a QuickBooks import vendor file
// The customer and employee format follows the QuickBooks field order.
// The employee and contact format are based on the QuickBook export files. There are no 'standard' contact and employee imports.
// Get a dataset based on a query on the example (crm) database (companies/contacts) tables
// By adding the empty values ('') you can create a dataset that goes right into the file
// There is need to add empty values at the end. The plug-in will finish the the row for you.
var query = "SELECT o.company_name,'','',o.company_name,'',c.firstname,'',c.surname" +
" FROM contacts AS c, companies AS o" +
" WHERE c.company_id=o.companiesid";
var dataset = databaseManager.getDataSetByQuery(controller.getServerName(), query, null, 1000);
// stop executing this method when the dataset is empty
// and show an error dialog
if (!dataset.getMaxRowIndex()) {
plugins.dialogs.showErrorDialog("Error.", "There are no records!", "OK");
Return;
}
// set the name of the file
// when no extension is set it will be .txt by default
var filePath = plugins.file.showFileSaveDialog();
// get the name of the operating system to know how to execute the,
// to the filetype attached,application
var osname = application.getOSName();
// check that we really selected a file
// if not ignore the rest of the code
if (filePath) {
var contact = plugins.it2be_data.qbcontact();
//we can use either a 2D array or a dataset for input
//you would typically use a 2D array from data you can not retrieve from the database
//in the below example we will create a 2D array from a dataset
//just to show you how to do it
//var selection = new Array();
//
//for (var i = 1 ; i <= dataset.getMaxRowIndex() ; i++) {
// var row = dataset.getRowAsArray(i);
//
// selection[i - 1] = row;
//}
//write the file
//filePath = contact.writeVendor(filePath, selection);
//we won't use the 'selection' array since a dataset can be used without creating an array
filePath = contact.writeVendor(filePath, dataset);
//open the data in the (to the filetype attached) application
//checking the os needs to be done via evaluation of a string
//you can also use the tools plugin that will give you an integer
if (osname.indexOf("Mac") > -1) {
//mac os x
application.executeProgram("open", filePath);
} else if (osname.indexOf("Windows") > -1) {
//windows
application.executeProgram("rundll32", "url.dll,FileProtocolHandler", filePath);
} else {
//linux etc. would love to know how to do this!
}
}
// Fields in QuickBooks import order
// Name
// Opening Balance
// Opening Balance As Of
// Company Name
// Salution
// First Name
// Middle Initial
// Last Name
// Address 1
// Address 2
// Address 3
// Address 4
// Address 5
// Contact
// Phone
// Fax
// Alternate Phone
// Alternate Contact
// Email
// Print On Check As
// Account Number
// Vendor Type
// Terms
// Credit Limit
// Tax ID
// Eligible for 1099
// Is Inactive
// Note
writeVendor
String writeVendor( String, Array<Array<Object>>, Boolean )
Write a QuickBooks import vendor fileParameters
String filePath the file path
Array<Array<Object>> set Object[][]
Boolean overwrite the overwrite
Returns
String fileName String
Supported Clients
SmartClient, WebClient, NGClient
Sample
// Write a QuickBooks import vendor file
// The customer and employee format follows the QuickBooks field order.
// The employee and contact format are based on the QuickBook export files. There are no 'standard' contact and employee imports.
// Get a dataset based on a query on the example (crm) database (companies/contacts) tables
// By adding the empty values ('') you can create a dataset that goes right into the file
// There is need to add empty values at the end. The plug-in will finish the the row for you.
var query = "SELECT o.company_name,'','',o.company_name,'',c.firstname,'',c.surname" +
" FROM contacts AS c, companies AS o" +
" WHERE c.company_id=o.companiesid";
var dataset = databaseManager.getDataSetByQuery(controller.getServerName(), query, null, 1000);
// stop executing this method when the dataset is empty
// and show an error dialog
if (!dataset.getMaxRowIndex()) {
plugins.dialogs.showErrorDialog("Error.", "There are no records!", "OK");
Return;
}
// set the name of the file
// when no extension is set it will be .txt by default
var filePath = plugins.file.showFileSaveDialog();
// get the name of the operating system to know how to execute the,
// to the filetype attached,application
var osname = application.getOSName();
// check that we really selected a file
// if not ignore the rest of the code
if (filePath) {
var contact = plugins.it2be_data.qbcontact();
//we can use either a 2D array or a dataset for input
//you would typically use a 2D array from data you can not retrieve from the database
//in the below example we will create a 2D array from a dataset
//just to show you how to do it
//var selection = new Array();
//
//for (var i = 1 ; i <= dataset.getMaxRowIndex() ; i++) {
// var row = dataset.getRowAsArray(i);
//
// selection[i - 1] = row;
//}
//write the file
//filePath = contact.writeVendor(filePath, selection);
//we won't use the 'selection' array since a dataset can be used without creating an array
filePath = contact.writeVendor(filePath, dataset);
//open the data in the (to the filetype attached) application
//checking the os needs to be done via evaluation of a string
//you can also use the tools plugin that will give you an integer
if (osname.indexOf("Mac") > -1) {
//mac os x
application.executeProgram("open", filePath);
} else if (osname.indexOf("Windows") > -1) {
//windows
application.executeProgram("rundll32", "url.dll,FileProtocolHandler", filePath);
} else {
//linux etc. would love to know how to do this!
}
}
// Fields in QuickBooks import order
// Name
// Opening Balance
// Opening Balance As Of
// Company Name
// Salution
// First Name
// Middle Initial
// Last Name
// Address 1
// Address 2
// Address 3
// Address 4
// Address 5
// Contact
// Phone
// Fax
// Alternate Phone
// Alternate Contact
// Email
// Print On Check As
// Account Number
// Vendor Type
// Terms
// Credit Limit
// Tax ID
// Eligible for 1099
// Is Inactive
// Note
writeVendor
String writeVendor( String, Object )
Write a QuickBooks import vendor fileParameters
String filePath the file path
Object set JSDataSet or Object[]
Returns
String fileName String
Supported Clients
SmartClient, WebClient, NGClient
Sample
// Write a QuickBooks import vendor file
// The customer and employee format follows the QuickBooks field order.
// The employee and contact format are based on the QuickBook export files. There are no 'standard' contact and employee imports.
// Get a dataset based on a query on the example (crm) database (companies/contacts) tables
// By adding the empty values ('') you can create a dataset that goes right into the file
// There is need to add empty values at the end. The plug-in will finish the the row for you.
var query = "SELECT o.company_name,'','',o.company_name,'',c.firstname,'',c.surname" +
" FROM contacts AS c, companies AS o" +
" WHERE c.company_id=o.companiesid";
var dataset = databaseManager.getDataSetByQuery(controller.getServerName(), query, null, 1000);
// stop executing this method when the dataset is empty
// and show an error dialog
if (!dataset.getMaxRowIndex()) {
plugins.dialogs.showErrorDialog("Error.", "There are no records!", "OK");
Return;
}
// set the name of the file
// when no extension is set it will be .txt by default
var filePath = plugins.file.showFileSaveDialog();
// get the name of the operating system to know how to execute the,
// to the filetype attached,application
var osname = application.getOSName();
// check that we really selected a file
// if not ignore the rest of the code
if (filePath) {
var contact = plugins.it2be_data.qbcontact();
//we can use either a 2D array or a dataset for input
//you would typically use a 2D array from data you can not retrieve from the database
//in the below example we will create a 2D array from a dataset
//just to show you how to do it
//var selection = new Array();
//
//for (var i = 1 ; i <= dataset.getMaxRowIndex() ; i++) {
// var row = dataset.getRowAsArray(i);
//
// selection[i - 1] = row;
//}
//write the file
//filePath = contact.writeVendor(filePath, selection);
//we won't use the 'selection' array since a dataset can be used without creating an array
filePath = contact.writeVendor(filePath, dataset);
//open the data in the (to the filetype attached) application
//checking the os needs to be done via evaluation of a string
//you can also use the tools plugin that will give you an integer
if (osname.indexOf("Mac") > -1) {
//mac os x
application.executeProgram("open", filePath);
} else if (osname.indexOf("Windows") > -1) {
//windows
application.executeProgram("rundll32", "url.dll,FileProtocolHandler", filePath);
} else {
//linux etc. would love to know how to do this!
}
}
// Fields in QuickBooks import order
// Name
// Opening Balance
// Opening Balance As Of
// Company Name
// Salution
// First Name
// Middle Initial
// Last Name
// Address 1
// Address 2
// Address 3
// Address 4
// Address 5
// Contact
// Phone
// Fax
// Alternate Phone
// Alternate Contact
// Email
// Print On Check As
// Account Number
// Vendor Type
// Terms
// Credit Limit
// Tax ID
// Eligible for 1099
// Is Inactive
// Note
writeVendor
String writeVendor( String, Array<Array<Object>> )
Write a QuickBooks import vendor fileParameters
String filePath the file path
Array<Array<Object>> set Object[][]
Returns
String fileName String
Supported Clients
SmartClient, WebClient, NGClient
Sample
// Write a QuickBooks import vendor file
// The customer and employee format follows the QuickBooks field order.
// The employee and contact format are based on the QuickBook export files. There are no 'standard' contact and employee imports.
// Get a dataset based on a query on the example (crm) database (companies/contacts) tables
// By adding the empty values ('') you can create a dataset that goes right into the file
// There is need to add empty values at the end. The plug-in will finish the the row for you.
var query = "SELECT o.company_name,'','',o.company_name,'',c.firstname,'',c.surname" +
" FROM contacts AS c, companies AS o" +
" WHERE c.company_id=o.companiesid";
var dataset = databaseManager.getDataSetByQuery(controller.getServerName(), query, null, 1000);
// stop executing this method when the dataset is empty
// and show an error dialog
if (!dataset.getMaxRowIndex()) {
plugins.dialogs.showErrorDialog("Error.", "There are no records!", "OK");
Return;
}
// set the name of the file
// when no extension is set it will be .txt by default
var filePath = plugins.file.showFileSaveDialog();
// get the name of the operating system to know how to execute the,
// to the filetype attached,application
var osname = application.getOSName();
// check that we really selected a file
// if not ignore the rest of the code
if (filePath) {
var contact = plugins.it2be_data.qbcontact();
//we can use either a 2D array or a dataset for input
//you would typically use a 2D array from data you can not retrieve from the database
//in the below example we will create a 2D array from a dataset
//just to show you how to do it
//var selection = new Array();
//
//for (var i = 1 ; i <= dataset.getMaxRowIndex() ; i++) {
// var row = dataset.getRowAsArray(i);
//
// selection[i - 1] = row;
//}
//write the file
//filePath = contact.writeVendor(filePath, selection);
//we won't use the 'selection' array since a dataset can be used without creating an array
filePath = contact.writeVendor(filePath, dataset);
//open the data in the (to the filetype attached) application
//checking the os needs to be done via evaluation of a string
//you can also use the tools plugin that will give you an integer
if (osname.indexOf("Mac") > -1) {
//mac os x
application.executeProgram("open", filePath);
} else if (osname.indexOf("Windows") > -1) {
//windows
application.executeProgram("rundll32", "url.dll,FileProtocolHandler", filePath);
} else {
//linux etc. would love to know how to do this!
}
}
// Fields in QuickBooks import order
// Name
// Opening Balance
// Opening Balance As Of
// Company Name
// Salution
// First Name
// Middle Initial
// Last Name
// Address 1
// Address 2
// Address 3
// Address 4
// Address 5
// Contact
// Phone
// Fax
// Alternate Phone
// Alternate Contact
// Email
// Print On Check As
// Account Number
// Vendor Type
// Terms
// Credit Limit
// Tax ID
// Eligible for 1099
// Is Inactive
// Note