Page Model

To refer to elements in the model, use the following syntax.

Viewing Element Types and Page Model Names

To view the page model name of a property and the property's parent, hover over the property until a blue dot appears, then option-right click the dot.

Changing Page Model Names

To change an element name using page model syntax:

  1. Double-click the element name in the Outline or the dataflow block header.
  2. Type the new name.
  3. Press Command + Enter on Mac or Ctrl + Enter on Windows.
If you change an element's page model name, be sure to update any scripts or bindings that refer to that element

Accessing and Setting Values using DGScript

The following example demonstrates how to use DGScript to access and set a value in the page model.

//Sets the "a" property of the current block to 
//the value of the string block located on 
//the parent dataflow.
		@.a=@parent.string.value;

To set a runtime value for an object property, use the = operator. To set a value that will be serialized as part of a subsequent save, use the ~= operator. The following examples demonstrate how to set both kinds of values.

//Sets the runtime "value" property of the parent object's "string" block to "stringValue".
	@parent.string.value="stringValue";

//Sets the serialized "value" property of the parent object's "string" block to "stringValue".
	@parent.string.value ~="stringValue";

Creating Bindings Using DGScript

To create a binding using DGScript, use the ~=[''] operator. The following examples demonstrate how to create bindings using DGScript.

//Creates a serialized binding of "height" to "width" of the parent component.
	@parent.width ~=['height'];
//Another binding example.
	@parent.string.value ~=['@parent.input.value'];

Example

The following image shows the dataflow model before invoking a script. This script sets values, creates a binding, and returns an output value.

The following is the script in the example.

@parent.stringA.value="abc123";
@parent.stringB.value="def456";
@parent.stringC.value ~=['@parent.stringB.value'];
@parent.stringD.value ~=@parent.stringA.value + "_" + @parent.stringB.value;
return "all done";

The following image shows the dataflow model after invoking the script.

Traversing the Page Model

You can use while loops to traverse the page model. The following example shows how to recursively search parent objects until a particular symbol is found.

searchObject=@parent;
while(searchObject !=null && typeof(searchObject) !='symbol'){
		searchObject=searchObject.@parent;
		}

if (searchObject !=null){
	// set the value
	}