Fun With Placeholders

Inserting Placeholders into text (Bubble Text or the Description or Short Description properties, or a Text Box on a Book Page) is a great feature in SAP Enable Now, but you’re not just limited to the options on the Insert drop-down menu within the Text Editor. You can insert a placeholder for many of an object’s other properties manually, if you like.

From within the Text Editor, (1) click on the Add button, then (2) select Insert Placeholder. From the Select Placeholder dialog box, (3) select the required predefined Placeholder, or (4) manually type the required Placeholder code yourself (see the table below). Or if you’re not entirely sure of the format, insert a predefined Placeholder and then just edit the property reference.

Property Placeholder
(Unique object ID) $#{project:.uid}
Language code (xx-XX) $#{project:.language}
Description $%{project:.description}
Short Description $%{project:.shortdesc}
Content Categories $#{project:.content_categories}
Keywords $#{project:.keywords}
Context $#{project:.context_id}
Roles $#{project:.roles}
Context Information $#{project:.context_info}
Learning App Context > Duration $#{project:.duration}

The table above shows Placeholder codes for Project (simulation) properties, but you can insert Placeholders for other object types by replacing project in the codes above with the relevant object type as follows:

  • Book Page: slide
  • Book: book
  • Text Unit: cdoc

You can also insert a reference to a custom property in exactly the same way – just use the identifier of the custom property (note that this is not the same as the label).

Note that Placeholder codes are case-sensitive. All predefined ones are lower case, but custom ones can be mixed case.

In case you’re wondering why some of the placeholders use $# and some use $%: The Description and Short Description are multi-line fields, and use $% by default to insert the text. You can use $# for these fields as well, but this will insert HTML tags (as text) so this is better suited to embedded code. If you use $% for a single-line field, this will result in a line break being inserted before it.

Finally, if you really want to push the envelope, all of the above examples refer to inserting Placeholders that reference the current object’s properties (or its parent object – for example, a Book that the Book Page is contained in). You can actually insert a Placeholder that inserts a property from an entirely separate object by inserting the UID of the required object, prefixed with an exclamation point, in-between the object type and the colon. For example:

$#{project!PR_DF31F0097D8EABAA:.caption}

would insert the Name of the project with the UID PR_DF31F0097D8EABAA into the text. This is very useful if you want to reference one document from another, because a reference based on a Placeholder will automatically be updated if the referenced object’s property changes (for example, if the referenced project is renamed).

20 thoughts on “Fun With Placeholders”

  1. Where does the default text for text bubbles come from? For example, Enter XYZ in the XXX box instead of field. Where can this be changed? Thanks!

  2. Hi Dirk,

    Is it possible to set formatting to certain placeholders, i.e. Object Name to always be Bold, and Input Text to always be Italic., etc?

    Thanks a lot!
    -Andrew

    1. Not directly, no. But if the text you are referencing is formatted, using $%{placeholder-id} should retain that formatting.

  3. Hello, can I make a placeholder to a property that has only ID (not UID)? For example text used in other book page?

    1. You mean to a specific text object on a Book Page, or a Bubble in a Simulation? No, I’ve tried that before and there’s no way to reference a property of a specific object within a Book Page. What you could do is move the text into a Text Unit and then reference that from both places… Or maybe I’m misunderstanding the question? What text are you trying to pull in?

      1. Thank you for the reply, that’s exactly what I meant. Unfortunately in my case a Text Unit doesn’t work also. I wanted to put a placeholder inside the question of quiz-connection and it still shows only html path as the question.

  4. Hi Dirk,
    I need the “Created by​​​​​​​​​” placeholder in the footer of the documentation output. If I place it directly into the documentation template it does not work. Can you explain how I can insert such placeholders into documentations? The Author placeholder available in Word does not help, as it always shows who edited the simulation last, not who created it initially.
    Thanks a lot! Laura

    1. Actually, the AUTHOR is hardcoded as the Username of the person who creates the document (which is the last person who changed it – as they have to change it to create the document). There’s no (easy) way to change that to use the Created By property without some major code changes. What I would suggest is using either a Document Property macro or a Custom Property (depending on where you want it to appear – if in every footer, a Document Property would likely be better. And easier to set up). You’ll need to insert a custom property for this in the Word document, and you’d need to maintain the property in the simulation itself (so extra work), but I do this to maintain an ‘Owner’ (and ‘Last Reviewed Date’) for my simulations – and at least then it will use the name you tell it to, and not just whoever happened to create it…

  5. Hi Dirk
    If I want to use the text of a, let’s say a dropdown field, how would I have to do it?
    If I take the property technical name I get only the key but not the keytext.

    I tried propertyname.caption (and others)

    Thanks for your help.

    Thomas

    1. Thomas: So you have a Select Single macro, and you want to use the selected value in a Placeholder? First, you need to enter the selected value into the Selected Value property of the Select Single (which you should do anyway…), and then you can use the Placeholder $#{choose_text} to insert this into the Bubble. (Or did I miss what you were asking? A drop-down field where?)

      1. Dirk: No I don’t need it in a project. I need this in the description of a group, for which I had configured some custom properties with dropdown.

        If I take the placeholder “doc_status” it shows me the selected “key”-value but not the “textkey”-value

        1. Tomas: Oh, understood. OK, well if you have a custom property that has a name of mycustomproperty, then you can use a placeholder of $#{project:.mycustomproperty} and that will do it. Adding .caption will give the name of the property. I just tested it out and this works well – it shows the selected value of the property.

          1. Dirk: Unfortunately it does still not what I need.
            The property is build as follow:
            EnumValue key=”1″ textkey=”In progress”
            What I need is the textkey “in progress” but it always shows the key “1”
            Maybe I misunderstood you but I tried your suggestion and it was still the same

          2. Thomas: If I have a custom property of:

            < ParamInfo type="ENUM" name="addinfo" helptext="setup OEM Enum">
            < EnumValue value="1" name="One">
            < EnumValue value="2" name="Two">
            < EnumValue value="3" name="Three">
            < EnumValue value="4" name="Four">
            < EnumValue value="5" name="Five">
            < EnumValue value="6" name="Six">
            < /ParamInfo >
            (Ignore the extra spaces – that’s to stop the malware blocker hiding ‘code’.)
            And then I select “Five” from the drop-down list, using a placeholder of $#{project:.addinfo}, I see the text “Five”. I’m not sure what you are doing differently…

          3. Dirk: Thanks for your code example. Now it works! The attribute_examples.xml from SAP put the code for a dropdown with “key” and “textkey” but you used “value” and “name”, with what it is possible to readout the “name”-value.
            Who knows why they use such uncommon terms…

What's on your mind?

This site uses Akismet to reduce spam. Learn how your comment data is processed.