Skip to Content
Author's profile photo Dirk Mayrock

Using Scripting Templates in DS1.1

Hi all,

have you noticed that there is the new functionality available that allows you create your own scripting templates that will be available also in Content Assistant?

Here is an example how to create your first simple template.

Initially SAP delivers an “if block” and an “if-else-block with compare”.

content assistent original.gif

Let’s assume you often need an “if-else-block without compare” and want to have that available in the Content Assistant.

content assistent final.gif

These are the steps to follow.

1. Go to Tools > Preferences open the Scripting Section on the left side of the screen and click on Templates

preferences original.gif

2. Select the line with the if-else-Block with compare in… select the coding shown in the Preview and copy it to the clipboard.

3. Select New

4. Fill in the fields as shown in the screen. Of course you can choose Name and Description as you like.

    But make sure to select the Context as “Statement“.

if else.gif

The code I used is:

if (${expression1} == ${value1}) {

${if_statements}

} else {

${else_statements}

}

    

That’s all… From now on this new entry will be available in the Content Assistant in the Scripting Editor.

If you want you can export that to an .XML file and send it to others. They then can import the new entry.

Regards

Dirk

Assigned Tags

      4 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Former Member
      Former Member

      Hi Dirk,

      Thanks for sharing this. I always was  annoyed about the 'compare' part of the if then else.

      I directly implemented that and it working fine.

      Marie

      Author's profile photo Former Member
      Former Member

      Hi all,

      How can we implement a loop statement such as for (....) or while(...)?


      thanks a lot

      Author's profile photo Dirk Mayrock
      Dirk Mayrock
      Blog Post Author

      Hi,

      loops are not supported in DS 1.2. So there is no way to build a template for that.

      All the best

      Dirk

      Author's profile photo Former Member
      Former Member

      Hi, thanksfor your reply, now I see that in version 1.3 for each statement is supported.

      Let's see how it works.

      thanks again