We are able to insert data or toggle visibility in content controls based on properties in custom document properties.
With the properties tool in the developer tab, it is possible to locate the content control property or add a new content control by using the add new content control option.
Use this article for the syntax of the binding in the content control.
Toggle visibility
If you would need to toggle visibility in a content control or a group of content controls, you would need to use the below syntax in the tag of the content control. This would then cause the content control to toggle visibility based on the existence of the custom document property. Here is an example:
{"SkabelonDesign":{"type":"Group","visibility":{"action":"Hide","binding":"Doc.Prop.thisIsADocProp","operator":"Contains","compareValues":[""]}}}
Notice that because the document property has no value, the content control will be "action":"Hide"
and not visible in the template. If it has a value, the content control will be made visible.
Data insertion
If the data from the custom document property is needed in the document, a content control to receive the data must be present. The tag in this could look like the example below where the custom document property "thisIsADocProp" is inserted in the content control.
{"SkabelonDesign":{"type":"Text","binding":"Doc.Prop.thisIsADocProp"}}
Depend data insertion on document property value
The insertion of data can be dependent on a value from the same or another document property. In this example, the syntax below must be inserted in the tag of a content control that is present in the document. Here, the data in the custom document property "thisIsADocProp" will be inserted in the content control, if the value of the other custom document property "thisIsAlsoADocProp" contains the word "hello".
{"SkabelonDesign":{"type":"Text","ignoreBlank":"true","binding":"Doc.Prop.thisIsADocProp","visibility":{"action":"Show","binding":"Doc.Prop.thisIsAlsoADocProp","operator":"Contains","compareValues":["hello"]}}}
The first document property which data must be inserted is defined in the first binding. Since the action in the visibility is determined to show and with a comparing value, the data will be hidden, if the comparing value is not present in the custom document property "thisIsAlsoADocProp".
Delete content control based on document properties
We are able to delete a content control in the document based on its reference to a certain document property. If we use the same example as above and replace "Show" with "Delete", this will delete the content control if the custom document property "thisIsAlsoADocProp" contains the word "hello".
{"SkabelonDesign":{"type":"Text","ignoreBlank":"true","binding":"Doc.Prop.thisIsADocProp","visibility":{"action":"Delete","binding":"Doc.Prop.thisIsAlsoADocProp","operator":"Contains","compareValues":["hello"]}}}
The opposite action of delete is keep which makes sure that the values are kept and not deleted. This can be handy if some must be saved for later update.
Binding DocumentData key/value in document properties
Create a document property by the name of the target and append _src to the name, e.g. docpropname_src
. The syntax for this binding is then {key.name.here}
.
Example
Our document property docpropname_src
has {teste}.{leste}
as value. Assume that teste
has 1
as value, and leste
has 2
as value. This will result in the document property value becoming 1.2
.
Thus, this creates a new document property that is called docpropname
and the value is 1.2
.
Comments
0 comments
Article is closed for comments.