I thought that might be it so I did 2 exports from different size foundsets. They produced different size xls files which leads me to believe that the export files are not empty.
the code I am using is this
Global Method “createExportFile”
var form = arguments[0] //string, formname
var fieldnames = arguments[1] // boolean, export with ColumnNames at top
var seperator = arguments[2] // string, choose seperator, for example: "\t" for TAB "," or ";"
var quotes = arguments[3] // boolean, ColumnNames with quotes
var columnnames = arguments[4] // string, ColumnNames seperated by: ";"
var exportfile = "" // create a text variable
// set the variable insertquotes to " or nothing
if (quotes == true) var insertquotes = '"'
else var insertquotes = "";
// split the columnames into an Array
var columnArray = columnnames.split(";")
// determine how many columns are used
var columnCount = columnArray.length
// if fieldnames is true than place the ColumnNames at top
if(fieldnames == true)
{
for(var x = 0;x <= columnCount - 1;x++)
{
if(x != columnCount-1) exportfile += columnArray[x] + seperator
else exportfile += columnArray[x]
}
// make an 'Enter'
exportfile += "\n"
}
// loop thru the foundset
for(var i = 1;i <= forms[form].foundset.getSize();i++)
{
var record = forms[form].foundset.getRecord(i);
for(var x=0; x <= columnCount-1;x++)
{
if(record[columnArray[x]])
{
utils.stringReplace(record[columnArray[x]],'\n', '')
if(x != columnCount-1) exportfile += insertquotes + record[columnArray[x]] + insertquotes + seperator
else exportfile += insertquotes + record[columnArray[x]] + insertquotes
}
else
{
if(x != columnCount-1) exportfile += insertquotes + seperator
else exportfile += insertquotes
}
}
exportfile += "\n"
}
//open dialog, with a suggested filename
var save = application.showFileSaveDialog('file_export.xls')
if(save != null)
{
var success = application.writeTXTFile(save,exportfile);
if (success)
{
plugins.dialogs.showInfoDialog('Info', 'The File is saved!','OK');
}
else
{
plugins.dialogs.showErrorDialog('Warning', 'The File is NOT saved because of an error!','OK');
}
}
Global Method “startExportFile”
//first argument: give the form name
//show select,returns nothing when canceled
var form = plugins.dialogs.showSelectDialog('Select','please select a form for export','DataSheets','Software','Equipment');
//second argument: boolean, export with ColumnNames at top
//third argument: string, choose seperator, for example: "\t" for TAB "," or ";"
//fourth argument: boolean, ColumnNames with quotes.
//fifth argument: string, ColumnNames seperated by: ";"
createExportFile(form,true,"\t",true,";");
It doesn’t look like there is any platform specific code in the “createExportMethod” So maybe I am sending blanks but why would the export files be different sizes?
What do you think?
Thanks
-Nick-