InDesign CS with PageMaker plugin on Windows.
Using the JS data merge example from the scripting addendum, I'm able to merge all records into my document. But I don't understand how to only merge a single record. I included the script I'm using below. The addendum indicates I need to use RecordSelection.oneRecord and recordNumber to do what I need, but everything I've tried only generates errors, mostly "undefined is not an object". Can someone show me how to set those properties in this JS script so that I can merge any record I want?
current script:
if(app.documents.length != 0){
var myDocument = app.activeDocument;
app.dataMergeOptions.removeBlankLines = true;
// app.dataMergePreference.RecordSelection.oneRecord ???
//Select a source file.
var myDataFile = File.openDialog("Select a data file")
if(myDataFile != ""){
myDocument.dataMergeProperties.selectDataSource(myDataFile, DataSourceType.commaSeparated);
myDocument.dataMergeProperties.mergeRecords();
}
}
Thank you in advance to anyone who can help me out.
David Rock
Using the JS data merge example from the scripting addendum, I'm able to merge all records into my document. But I don't understand how to only merge a single record. I included the script I'm using below. The addendum indicates I need to use RecordSelection.oneRecord and recordNumber to do what I need, but everything I've tried only generates errors, mostly "undefined is not an object". Can someone show me how to set those properties in this JS script so that I can merge any record I want?
current script:
if(app.documents.length != 0){
var myDocument = app.activeDocument;
app.dataMergeOptions.removeBlankLines = true;
// app.dataMergePreference.RecordSelection.oneRecord ???
//Select a source file.
var myDataFile = File.openDialog("Select a data file")
if(myDataFile != ""){
myDocument.dataMergeProperties.selectDataSource(myDataFile, DataSourceType.commaSeparated);
myDocument.dataMergeProperties.mergeRecords();
}
}
Thank you in advance to anyone who can help me out.
David Rock