Thanks for an interesting question.
You don’t say how the “publication date custom field” was created and is maintained. I can offer a solution but it will require converting the field content to a format that will sort correctly, then using an MLA feature to re-format the values when you display them. The orderby
parameter can only work with the values it find in the database; it doesn’t have date-specific variations.
Have a look in the “Field-level option/format values” section of the Settings/Media Library Assistant Documentation tab. In particular, look at the “,date(f)” format value, which is the key to your solution. If your custom field contains values such as “2014:09” you can sort them properly and display them as “September 2014” by coding something like “[+custom:publication_date,date(F Y)+]” in your custom markup template.
You can also use the “,date(f)” format value to convert your custom field content to the proper format. You can create a custom field mapping rule for the one-time format conversion task:
- Navigate to the Settings/Media Library Assistant “Custom Fields” tab.
- Scroll down to the “Add a new Mapping Rule” area, since you already have the custom field defined.
- In the first dropdown box, select your field name, “publication_date”.
- From the Data Source dropdown list, select “- Template (see below) -“.
- In the text box below the dropdown enter “[+custom:Archive Date,date(Y:m)+]”. That takes the existing value like “September 2014”, converts it to a Timestamp and then converts it back to the “2014:09” format.
- In the “Existing Text” dropdown list, select “Replace”.
- In the “Format” dropdown list, select “Native”.
- Click the “MLA Column” check box if you want to make the field available in the Media/Assistant submenu table. If you want to edit the field manually, check the “Quick Edit” and perhaps the “Bulk Edit” checkbox as well.
- In the “Option:” dropdown list, select “Text”.
- Check the “Delete NULL Values” checkbox to save database space for items with no publication_date value.
- Click the “Add Rule” button to save your work and run the rule later or click the “Map All Attachments” to run the rule immediately without saving it.
Once the rule is in place you can use the Media/Edit Media screen to test it on one item or the Media/Assistant Bulk Edit area to test it on a small number of items. When you are satisfied with it, use the “Mar All Attachments” button to run the rule for all your items and complete the work. Once the conversion is complete you will want to delete the rule or set the “Data Source” dropdown to “- None (select a value) -” to prevent the rule from interfering with your ongoing maintenance.
That should get you started on a solution for your problem. You will have to adapt the solution to your application and workflow, of course.
I am marking this topic resolved, but please update it if you have any problems or further questions regarding the above suggestions.