Urcap Program-Node children duplication

Hello,
I’m trying to let my user add children inside the program-node.
For that, I change the return value of isChildren allowed from the service, and I use writter.appendChildren() where I want it to be.
Problems come when I try to put the children twice in the same scriptWritter.

For example:
This work (just adding children at the end)

public void generateScript(ScriptWriter writer) {
	List<String> script = readScriptFile();  // each lines are simple instructions like movel, or commentaries
	for (String line : script){
		writer.appendLine(line);
	}
	writer.writeChildren();
}

And this show me an error (adding multiple times the children in the scriptWritter):

public void generateScript(ScriptWriter writer) {
	List<String> script = readScriptFile();  // each lines are simple instructions like movel, or commentaries
	for (String line : script){
               if(line.equals("# Raise TCP")){ // the "script" array contains more than one of these
                   writer.writeChildren();
               }
	       else{
                   writer.appendLine(line);
               }
	}
}

Here is the error:

It seems that we just can’t add a second time a children, but maybe I am missing something ?

1 Like