Dataset
Dataset
Section titled “Dataset”app.activeDocument.dataSets[index]
Description
Section titled “Description”A set of data used for dynamic publishing. A dataset allows you to collect a number of variables and their dynamic data into one object.
You must have at least one variable bound to an art item in order to create a dataset. See the class Variable.
Properties
Section titled “Properties”Dataset.name
Section titled “Dataset.name”app.activeDocument.dataSets[index].name
Description
Section titled “Description”Then name of the dataset.
String.
Dataset.parent
Section titled “Dataset.parent”app.activeDocument.dataSets[index].parent
Description
Section titled “Description”The name of the object that contains this dataset.
Document; read-only.
Dataset.typename
Section titled “Dataset.typename”app.activeDocument.dataSets[index].typename
Description
Section titled “Description”The class name of the referenced object.
String.
Methods
Section titled “Methods”Dataset.display()
Section titled “Dataset.display()”app.activeDocument.dataSets[index].display()
Description
Section titled “Description”Displays the dataset.
Returns
Section titled “Returns”Nothing.
Dataset.remove()
Section titled “Dataset.remove()”app.activeDocument.dataSets[index].remove()
Description
Section titled “Description”Deletes this object.
Returns
Section titled “Returns”Nothing.
Dataset.update()
Section titled “Dataset.update()”app.activeDocument.dataSets[index].update()
Description
Section titled “Description”Updates the dataset.
Returns
Section titled “Returns”Nothing.
Example
Section titled “Example”Using variables and datasets
Section titled “Using variables and datasets”// Creates two variables, 1 visibility and 1 text,// creates two datasets each with different values for the variables,// then displays both datasets
var docRef = documents.add();
// Create visibility variablevar itemRef = docRef.pathItems.rectangle(600, 200, 150, 150);var colorRef = new RGBColor;colorRef.red = 255;itemRef.fillColor = colorRef;
var visibilityVar = docRef.variables.add();visibilityVar.kind = VariableKind.VISIBILITY;itemRef.visibilityVariable = visibilityVar;
// Create text variablevar textRef = docRef.textFrames.add();textRef.contents = "Text Variable, dataset 1";textRef.top = 400;textRef.left = 200;
var textVar = docRef.variables.add();textVar.kind = VariableKind.TEXTUAL;textRef.contentVariable = textVar;redraw();
// Create dataset 1var ds1 = docRef.dataSets.add();
// Change variable values and create dataset 2itemRef.hidden = true;textRef.contents = "Text Variable, dataset 2";redraw();var ds2 = docRef.dataSets.add();
// display each datasetds1.display();redraw();ds2.display();redraw();