System title computed from display title

I would like to find a way to transform the display title of a content item into the system title field and replace spaces with underscores. It seems that most of our users are doing this on their own and I think it would simplify things if this field was computed in some way.

Could this be accomplished with an input transformation? I have tried using the sys_textExtraction and sysCopyParameter extensions but receive an error “contentid may not be null”.

You definitely don’t want sys_textExtraction, it has a very different purpose. You could use copy parameter and the replace transform individually. A simpler way is to use the sys_Replace extension directly to replace ’ ’ w/ ‘_’. This will be quite rigid however, meaning that it will always perform this operation. And if the ctype doesn’t have a display title field, the insert will fail. In this scenario, you would need to write a simple extension that handled this case.
Not sure why you got that message, neither of those extensions care about the contentid. Maybe you used the wrong type for onen of their parameter values.

I am still trying to get this to work but I cannot get the transformation to occur.

I am specifying an input transformation of the sys_title filed in the ‘Content Types Global Configuration’ item in the Content Design tab of the workbench.

The source I am using is, type: ‘Content Item Data’, value:‘Shared/displaytitle’. This value changes to ‘PSXContentItemData/displaytitle’ after I select ‘ok’ in the value selector popup window.

The search is (including quotes): ’ ’

Replacement (including quotes): ‘_’

I have tried replacing ‘a’ with ‘_’ to see if it was just not finding the spaces but even that does not seem to work. Is there something special when transforming global content types?

There is nothing particularly special about the global types. Your problem is your source type. ‘Content Item Data’ should almost never be used. There are only very special circumstances where you would use this. What it does is query the system and load the item specified by the sys_contentid value. When creating a new item, there is no id and you would receive the error you originally noted.

Instead of using that type, you should use ‘Single Html Param’ type for displaytitle.

That works much better. Is is possible to have more than one transformation occur? The rules input box seems to indicate that I can do this as well as control the order in which these transformations happen, however it looks like it stops after the first rule. I would like to remove any unauthorized characters if they appear in the title such as a question mark.

I would really like to get this feature working before launch, it would reduce the complexity to our end users in that they would only need to fill out the display title and not worry about the formatting of the other fields (sys_title and filename).

I have set up two input transforms on the sys_title field, one uses the extension “Replace” to remove spaces and replace them with hyphens. The other simply calls the To Lower transform type to make all of the letters lowercase. Each transform has been tested and works independently, however the transform under the first transform never gets run. I can reverse the order of the transforms and now the new transform on the bottom does not run but the first one will. How can I run more than one input transform? The documentation indicates that this is possible.

Thanks for your help,

Steve

I thought I found a way to accomplish multiple item transformations, by adding new hidden local fields and processing the input transforms one by one, passing the modified variable to each new field. This does not seem to work either and it looks like I am running into the same problem with multiple item transformations. The process will work if I do the following steps:

[ol]
[li]Create a new content item using the new calculated fields.
[/li][li]Input a display title with spaces, uppercase text, and an invalid character (e.g. Testing Content?).
[/li][li]Click insert, this will cause a validation error because sys_title and filename are empty but the title_lowered field is now populated (e.g. testing content?).
[/li][li]Click insert again, this will cause a validation error because sys_title and filename are still not populated but the title_nospace field is now populated (e.g. testing-content?).
[/li][li]Click insert again, this will populate the sys_title field AND the filename field (e.g. testing-content) and remove the validation error.
[/li][/ol]

I understand why this doesn’t work but I think there should be a way to accomplish this. I am using HTML Parameter values, so maybe there is a way to process the variables during run-time? Does anyone have any suggestions?

There is a bug that limits execution of input and output field transforms to only a single one. One workaround is to write a custom transform that performs both operations. The source for both of these exits is included with the system. Trying to do the conversion using intermediate html variables may or may not (as in your case) work as the order of processing is not defined.

We already do this with a combination of copyParameter and a backend database trigger. This also appends the content id to the system title to help users identify unique items and to allow multiple items to be in the same folder with the same title.

If you need more info, shout.

Best Wishes

Georgina