Support site for Simplebim users
Advanced Techniques

Chaining templates

When you start using templates in a more advanced way it becomes important that your templates are easy to maintain. You want to avoid copying the same information into multiple templates, because then updating your templates after changes becomes difficult.

A good practice is to keep all your identity definitions in one template and make your other templates dependent on that template. This way you have a central repository for your identities.

Another good practice is to separate generic content from project specific content. You might for example have one template that trims a model for quantity take-off and another template that validates the model for quantity take-off based on agreement made in a specific project. You may also have company specific content such as model author information that you don’t want to repeat in multiple templates and model license information that needs to be defined separately for each exchange.

Template chaining works such, that the more specific template is made dependent on the more generic templates. The template you apply in simplebim is on the top of this structure (‘Project A’ in the example below) and it pulls in all the other dependent templates. Templates are applied in a sequence where the top template is applied last. This allows you to override content in the more generic templates by content from the more specific ones.

 

Using regular expressions

Regular expression is a powerful system for searching and manipulating text. It is very widely used and is implemented in most modern programming languages. This means that while it is initially quite difficult to understand there is no shortage of tutorials, tools and sample expressions. One good site for testing your regular expressions is http://regex101.com/. On this site you copy your sample values into one text box and develop your regular expression in another text box, and you see the result as you type.

 

 

Please note that regular expressions in simplebim are by default 'greedy' and if you want to use a non-greedy logic you must specify this in your expression.

Here are some examples to get you started. You can also contact us at support@datacubist.com if you have a case that you can't figure out on your own. When you ask for support, please give an example of a string your want to process and the expected outcome from that example string. We will then try to create the correct regular expression for you.

Regular Expression Text Selected Text
^(.*?): Basic Wall:EXT-1:2672323 Basic Wall
:(.*): Basic Wall:EXT-1:2672323 EXT-1
:(\d{0,})$ Basic Wall:EXT-1:2672323 2672323
(?<=KEY2=).*?(?=;) KEY1=A;KEY2=B;KEY3=C; B
(?>([^,]*),){4} A,B,C,D,E,F D