Search/Replace CC tag (W)

Modified on Mon, 5 Oct at 1:54 PM

BaseExtensions can be used to scan through a document and perform a search-and-replace on all content control tags that match criteria defined in parameters.

The feature will most commonly be for internal use, and not an end user. The feature could be used for moving from Templafy bindings to our DocumentData bindings. In other cases, it can also be from Templafy binding to Templafy binding in a document where bindings appear lots of times in content control tags.

CMD

XML
<Cmd case="BaseExtensions:search-replace-cc-tag"
	toSearchStart="x"
	toSearchEnd="x"
	toReplaceStart="x"
	toReplaceEnd="x"
/>

Parameters

The parameters in above command can be used to define a range to search for in the beginning and in the end of the content control tag, leaving a range in the middle to remain untouched.

Besides parameters being pretty self-explanatory, below example serves to illustrate how to use the feature to switch from Templafy bindings to DocumentData bindings.

Example of usage

Be aware that certain characters may need escaping in XML. Colors are for didactic reasons.

XML
<Cmd case="BaseExtensions:search-replace-cc-tag"
	toSearchStart="{"templafy":{"visibility":{"action":"delete","compareValue":"Yes","binding":"Form."
	toSearchEnd="","operator":"NotEquals"},"type":"group"}}"
	toReplaceStart="{"SkabelonDesign":{"type":"group","visibility":{"action":"keep","binding":"Doc.Prop.Form."
	toReplaceEnd="","operator":"Equals","compareValues":["Yes"]}}}"
/>

This will perform the following search/replace, leaving the variable in the middle untouched:

Search

Code
{"templafy":{"visibility":{"action":"delete","compareValue":"Yes","binding":"Form.
CFS_CDDbuyside.CFS-CDDbuyside
","operator":"NotEquals"},"type":"group"}}

Replace

Code
{"SkabelonDesign":{"type":"group","visibility":{"action":"keep","binding":"Doc.Prop.Form.
CFS_CDDbuyside.CFS-CDDbuyside
","operator":"Equals","compareValues":["Yes"]}}}

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article