Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Dataset not updating automatically

New Here ,
Oct 27, 2009 Oct 27, 2009

Hello,

I have a graph that is dynamic.  I already have a variable set up and also a dataset.  This file is saved.

Basically, I am trying to write some code that will open the document, import the variable file (with the new data from the xml file) and then update the graph.

Using the code below, the file opens and also the import of the variables is succesful.  However, the graph is not updating automatically.  I need to actually select the value from the dropdown in the variables window.  Can anyone please tell me what I am doing wrong.

   // Open the file and import the datasets and variables from xml file
  var docRef = open(new File(aiChartFilePath));
  
   alert("Importing the datasets.");
 
   docRef.importVariables(new File(xmlFilePath));

var ds1 = docRef.dataSets.getByName("Chart1Variable");
alert(ds1); //this gives the "DataSet Chart1Variable"
docRef.activeDataset = ds1;
ds1.display();
redraw();

rs = "OK";

Thanks in advance for your help.

TOPICS
Scripting
8.0K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Contributor , Nov 13, 2009 Nov 13, 2009

This should be it ... my original code was a lil bit messy cause was written in a hurry

#target indesign


function main() {

if (app.documents.length == 0) {

alert("Please have an 'Indesign' document before running this script.");

return;

}

var docRef = app.documents[0];

$.sleep( 3000 ); // Just my novice delay method

updateGraph();

$.sleep( 3000 ); // Ditto here

//updateGraph();// done this twice because there seems to be a bug where the dataset is not getting updated first time around

$.sleep( 3000 );
//} /

...
Translate
Adobe
New Here ,
Nov 17, 2009 Nov 17, 2009
LATEST

Hi Sonic,

THANKS!!!  Finally it worked.  I had to increase the sleep time but once I did that everything works.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Nov 02, 2009 Nov 02, 2009

Hello,

would you mind providing as attachment the .ai file and the xml file? I'll look into it a lil bit later as i dun have time right now. Problem lies probably somewhere in the variable binding ...

cheers;

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Nov 02, 2009 Nov 02, 2009

Hi,

Files attached as requested.  Thanks.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines