6

I am trying the new DWT Functions for delimiting component fields in 2013 SP1. I am getting an error with the simplest of DWT TBBs:

@@FieldStartMarker("heading")@@
  @@FieldValueStartMarker()@@
    @@Fields.heading@@
  @@FieldValueEndMarker()@@
@@FieldEndMarker()@@

When I put this in a component template and run (in either template builder or preview) on a component which has a heading field, I get an error as follows. Any ideas?

FieldStartMarker does not have a FieldEndMarker. at Tridion.ContentManager.Templating.Expression.BuiltInFunctions.Dispose() at Tridion.ContentManager.Templating.Package.Dispose() at Tridion.ContentManager.Templating.Engine.TransformItem(Template template, IdentifiableObject itemToRender) at Tridion.ContentManager.Templating.Debugging.DebuggingEngine.Run()
at Tridion.ContentManager.Templating.Debugging.DebugSession.Run()

  • Customer support is investigating this - I will update when I hear more – Will Price Dec 19 '13 at 10:06
7

I think it you are missing the GetFieldValue method.

@@FieldStartMarker("heading")@@
  @@FieldValueStartMarker()@@
    @@GetFieldValue("heading")@@
  @@FieldValueEndMarker()@@
@@FieldEndMarker()@@
| improve this answer | |
  • Thanks Eric - but that doesnt work. I see in the documentation that you should just be able to write out the field value 'normally' : sdllivecontent.sdl.com/LiveContent/web/… – Will Price Dec 17 '13 at 14:23
  • Thanks Will. I am trying to do something similar and cannot get this to work - I am curious to know if you got any updates from Tridion Support about this @@FieldValueStartMarker()@@ @@GetFieldValue('overview.executiveSummary', 0)@@ @@FieldValueEndMarker()@@ – S. T. Apr 19 '14 at 15:38
5

You often get this error message when you have another TBB which pushes supporting components into the package before your Dreamweaver/Layout TBB (In my case it was components containing configuration and resources)

It seems that the Field...Marker() functions get the context component from the package by finding the first item in the package of type Component, not by getting the item from the package with package name Component, so they will then try to read a field which does not exist in the schema, skip it and then have an error when trying to close the field.

To fix the error, you need to add some code to your TBB which adds components to the package to ensure that the context component is moved to the top of the package stack. I use this utility method in my TemplateBase class:

    protected void PutContextComponentOnTop()
    {
        Item mainComponent = m_Package.GetByName("Component");
        if (mainComponent != null)
        {
            m_Package.Remove(mainComponent);
            m_Package.PushItem("Component", mainComponent);
        }
    }

Note I have also raised a Customer Support incident for this, so maybe it will be fixed in the future.

| improve this answer | |
1

The problem with this syntax is following:

@@FieldStartMarker("heading")@@

The error explains it. It cannot map heading to certain field. If you want to use it correctly, you should map it to full field path:

@@FieldStartMarker("Component.Fields.heading")@@

That way it will be evaluated to concrete field value. For writing out the value, you can also use:

 @@GetFieldValue("Component.Fields.heading")@@

or,

@@Component.Fields.heading@@

Both will work.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.