cancel
Showing results for 
Search instead for 
Did you mean: 

Javascript help needed

thk
Champ on-the-rise
Champ on-the-rise
Hi

Im no javascript programmer: can anybody post me an example for a java script which moves all existing content files from space to a subspace? I cannot use a simple rule because the action should be triggered by a single flagfile and a simple rule then would only apply the action on this triggering flagfile alone instead of on all documents in the space.

Thanks for help
2 REPLIES 2

invictus9
Champ in-the-making
Champ in-the-making
var subspace = space.childByNamePath("name of subspace");
for (var i in space.children) {
  if ( space.children.name != "flagfilename" ) {
    space.children.move(subspace);
  }
}


of course, you need to put in some sanity checks.

thk
Champ on-the-rise
Champ on-the-rise
Hi,

I tried your version but nothing happpens (neither trigger nor other files are moved).

I really don't understand it:

That works but only moves the trigger_file not the other files:

var dss = space.childByNamePath("DSS");
document.move(dss);

This doesn't work, nothing happens (neither trigger nor other files are moved) but why?:
function movedoc(document)
{
var dss = space.childByNamePath("DSS");
for each (file in space.children)
{
file.move(dss);
}
}
movedoc(document);

And here also nothing happens:

var dss = space.childByNamePath("DSS");
for each (file in space.children)
{
file.move(dss);
}


Thanks for any help