Excel — an excellent editor for Tridion component lists

TridionExcelTridionOne of our customers has a pattern where they have a list of component links in a container component. Some of these container components are hundreds of links long.

Although the contained components are ported from DEV to UAT to PROD, adding the components to the containers is done manually. This usually works well, but what happens when some links are missing? How do you sort through hundreds of component links to find if you need to add one?

In this post I show how to use Excel and Notepad++ to work with the contents of the container component.

The component that we are working with looks like the image below.

ExcelAndNotepad01

This shows six out of about 250 linked components, which are not in any order. Sorting through this component manually, to see if we need to add another component link, will take a long time indeed. There is a faster way, but we have to be mindful of the schema.

The schema for this is very simple. It is a single repeatable field. This technique will not work if there are multiple fields.

ExcelAndNotepad01a

To sort the component links within this very simple container:

1) View the Source tab of the container

ExcelAndNotepad02

2) Copy the entire contents to Notepad++

ExcelAndNotepad03

3) In this case we want to sort the file by the xlink:title property. Press Ctrl-H to open Search & Replace; replace xlink:title with \t\txklink:title. Be sure that the “Extended” search mode is used so that “\t” is seen as a tab character.

ExcelAndNotepad04

 

ExcelAndNotepad05

4) Copy All, and paste into a blank spreadsheet in Excel. The columns break on the \t characters. The first column (not indented) is in column A. The second is in column B. The first tab means that column C is empty. The xlink:title, and everything past that, is in column D.

ExcelAndNotepad06

 

Note that cell D2 contains the xlink:title value. We are now able to sort by this column.

5) Select the range that includes columns B through D, but excludes the top & bottom row, and sort the range by column D.

ExcelAndNotepad07

 

Note that column D is now ordered alphabetically.

6) Copy all of the rows, including the top and bottom row, and paste back in to Notepad++

7) replace \t\txlink:title with xlink:title to remove the two tab characters.

ExcelAndNotepad08

8) Copy All & paste in to the Source tab in Tridion.

ExcelAndNotepad09

9) Save and check in the updated component.

ExcelAndNotepad10

And there you have it — We have used Excel and Notepad++ to quickly, easily, and safely, sort all of the component links in a container.

We can now scan through the list of components, alphabetically, and identify any that are duplicated or are missing.

This isn’t something that you will do every day, but when you need to do it then it can really help.

This entry was posted in Tridion news by Paul Russell. Bookmark the permalink.

About Paul Russell

Paul has 30+ years of experience with developing software, and has watched the internet evolve into the web and web 2.0. It has always been an exciting time to develop software because so many things are happening and everything is new. I'm really looking forward to what tomorrow has to offer!

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>