# Configure an assignmentnode

**URL:** <https://forum.universal-robots.com/t/configure-an-assignmentnode/1791>\
**Category:** URCaps SDK\
**Created:** [March 26, 2018, 9:00am UTC](https://forum.universal-robots.com/t/configure-an-assignmentnode/1791 "2018-03-26T09:00:36Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![anon12495347](https://avatars.discourse-cdn.com/v4/letter/a/779978/32.png) [@anon12495347](https://forum.universal-robots.com/u/anon12495347)\
**Post date:** [March 26, 2018, 9:00am UTC](https://forum.universal-robots.com/t/configure-an-assignmentnode/1791/1 "2018-03-26T09:00:36Z")

</div>

Hello everyone,

Does someone have an example how to add an assignmentnode in the tree and configure it with java?

We’re able to add the assignmentnode to the tree but we can’t configure it with an expression.

Looking forward to hearing from you.

---

<div class="post-metadata">

**Author:** ![ronny.buch](https://avatars.discourse-cdn.com/v4/letter/r/e480ec/32.png) [@ronny.buch](https://forum.universal-robots.com/u/ronny.buch)\
**Post date:** [August 22, 2018, 9:25am UTC](https://forum.universal-robots.com/t/configure-an-assignmentnode/1791/2 "2018-08-22T09:25:22Z")

</div>

any Solutions? I want to do the same Thing, but have Problems with the creatExpressionConfig

---

<div class="post-metadata">

**Author:** ![anon32366091](https://avatars.discourse-cdn.com/v4/letter/a/ed8c4c/32.png) [@anon32366091](https://forum.universal-robots.com/u/anon32366091)\
**Post date:** [August 23, 2018, 11:38am UTC](https://forum.universal-robots.com/t/configure-an-assignmentnode/1791/3 "2018-08-23T11:38:49Z")

</div>

I got this code working for an Assingment Node.

Code:

```
	try {
		myMoveNode = programNodeFactory.createMoveNode();
		TreeNode rootTreeNode = programModel.getRootTreeNode(this);	
		
		try {	//Write var
				clearErrors();
				//Create a global variable with an initial value and store it in the data model to make it available to all program nodes.
				Start = variableFactory.createGlobalVariable("On");
				myDataModel.set(SELECTED_VAR, Start);
				System.out.print("variabele gemaakt");
				
			} catch (VariableException e) {
				setError(e.getLocalizedMessage());
				e.printStackTrace();
				System.out.print("variabele mislukt");
			}

			try {
				ExStartLas = urCapAPI.getValueFactoryProvider().createExpressionBuilder().append("False").build();
				
			} catch (InvalidExpressionException e) {
				setError(e.getLocalizedMessage());
				e.printStackTrace();			
			}

			myAssignmentNode = programNodeFactory.createAssignmentNode();
			myTreeNode = rootTreeNode.addChild(myAssignmentNode);
			myAssignmentNodeConfigFactory = myAssignmentNode.getConfigFactory();
			myAssignmentNodeConfig = myAssignmentNodeConfigFactory.createExpressionConfig(Start, ExStart);
			myAssignmentNode.setConfig(myAssignmentNodeConfig);
			
		} catch (TreeStructureException e) {
			e.printStackTrace();
		}
```

---

<div class="post-metadata">

**Author:** ![ronny.buch](https://avatars.discourse-cdn.com/v4/letter/r/e480ec/32.png) [@ronny.buch](https://forum.universal-robots.com/u/ronny.buch)\
**Post date:** [August 23, 2018, 1:12pm UTC](https://forum.universal-robots.com/t/configure-an-assignmentnode/1791/4 "2018-08-23T13:12:55Z")

</div>

OK thx i will try it !
