Skip to content

Dataset

app.activeDocument.dataSets[index]

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.


app.activeDocument.dataSets[index].name

Then name of the dataset.

String.


app.activeDocument.dataSets[index].parent

The name of the object that contains this dataset.

Document; read-only.


app.activeDocument.dataSets[index].typename

The class name of the referenced object.

String.


app.activeDocument.dataSets[index].display()

Displays the dataset.

Nothing.


app.activeDocument.dataSets[index].remove()

Deletes this object.

Nothing.


app.activeDocument.dataSets[index].update()

Updates the dataset.

Nothing.


// 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 variable
var 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 variable
var 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 1
var ds1 = docRef.dataSets.add();
// Change variable values and create dataset 2
itemRef.hidden = true;
textRef.contents = "Text Variable, dataset 2";
redraw();
var ds2 = docRef.dataSets.add();
// display each dataset
ds1.display();
redraw();
ds2.display();
redraw();