In order to update a page of html - this is a long list that involves a
lot of html table rows - I have a script that is only invoked when the
parent data changes. The script deletes the old document and creates a
new one, or in another instance replaces the source.
e.g.
//firstly I build the page source in a variable called 'usr_alphasource'

//then, to update the page wiuth the new source
path='/abc/usr_alphalist.stm';
doc =site.GetDocument( path );
if ( doc== null ) {
doc2=site.CreateDocument("/abc/usr_alphalist.stm", "text",
"description", usr_alphasource, document.connectionId);
}else{
doc.source = usr_alphasource;
}



I am having trouble getting this to work consistently - ie.it works most
of the time.

Unfortunately, 'most of the time' is not sufficient.

Is this some subtle state thing to do with the connection?


I note in the Powerdynamo documentation:

"CreateDocument and DeleteDocument—It is not possible to delete a
document that a script is actively referencing. Because of this,
CreateDocument and DeleteDocument should not be used in the same script
unless at the time of DeleteDocument the document object has gone out
of scope, or has been set to null."

I have tried this "CreateDocument and DeleteDocument" method as well
with similar inconsistent results.

Could someone please help with this.

Thanks

Tony Pfitzner