Vestibulum imperdiet, magna nec eleifend rutrum, nunc lectus vestibulum velit, euismod lacinia quam nisl id lorem. Duis enim nulla, luctus eu, dapibus lacinia, venenatis id, quam. Nulla enim eros, porttitor eu, tempus id, varius non, nibh. Aliquam sem leo, vulputate sed, convallis at, ultricies quis, justo. Etiam arcu dui, faucibus eget, placerat vel, sodales eget, orci. Vestibulum dui sem, pulvinar sed, imperdiet nec, iaculis nec, leo. Vivamus nisl nibh, iaculis vitae, viverra sit amet, ullamcorper vitae, turpis. Â Then after this DWT a new entry will appear called “LinkListCount”.Integer gravida nibh quis urna Augue praesent a lacus at urna congue rutrumĭonec condimentum, urna non molestie semper, ligula enim ornare nibh, quis laoreet eros quam eget ante. Â So if we had a multi-value component link field in the component called “LinkList”, then “Get Linked Components” should fetch a component array and call it after your field name – something like “LinkList”. Package.PushItem(kvp.Key + "Count", package.CreateStringItem(ContentType.Number, componentCount.ToString())) Īfter this TBB runs, you’ll get a new entry on the package with the count for each “Tridion/Component” item type that “Get Linked Components” fetches. Int componentCount = linkCollectionCPList.Count IComponentPresentationList linkCollectionCPList = ComponentPresentationList.FromXml(()) This code has to be kept in a separate loop since you can't modify the package.GetEntries collection while looping through it.įoreach (KeyValuePair kvp in extractedComponentLists) List> extractedComponentLists = new List>() įoreach (KeyValuePair kvp in package.GetEntries()) / the total count of components or when needing to know if you're on the last component. This is useful when a Dreamweaver TBB needs to know ![]() / adds a new package item with the array entry count. / This TBB loops through all the items in the package and for any items which are Component Arrays ![]() Â It’s the best thing since the combustion engine/sliced bread/eh…SDL Tridion CMS).Īnyway, just drop this C# Fragment in after “Get Linked Components”: So here is a quick C# fragment that should be used in sequence after Will Price’s “Get Linked Components” extension (just Google it if you don’t know. Â Besides, I couldn’t let it linger the next day. Â It was past my sys admin’s office time, so I couldn’t ask him to deploy a new Custom Functions DLL to the CM server’s GAC/bin, but I just had to get the template done by end of day – I was in the zone. Though, here is another approach which I used one late night in the office wanting to finish a template. KeywordField typedField = field as KeywordField NumberField typedField = field as NumberField TextField typedField = field as TextField ĭateField typedField = field as DateField Logger.Debug("Field is EmbeddedSchemaField") ĮmbeddedSchemaField typedField = field as EmbeddedSchemaField Ĭount = typedField.Values != null ? : 0 Logger.Debug("Field is ComponentLinkField") ĬomponentLinkField typedField = field as ComponentLinkField Ĭount = typedField.Values!=null?:0 Logger.Debug("Field type: " + field.GetType().Name) ![]() Logger.Debug("Found item field: " + fieldName) Logger.Debug("Got component itemfields") ItemFields fields = new ItemFields(c.Content, c.Schema) find the field collection and get the count IdentifiableObject item = _engine.GetObject(componentTcmId) Public string TemplateRepeatCount(string componentTcmId, string fieldName)
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |