Skip to main content
areohbee
Legend
July 9, 2010
Question

How To Set Custom Metadata Programmatically?

  • July 9, 2010
  • 3 replies
  • 1148 views

I could have sworn there was a way, but I sure can't figure it out right now - anybody know if or how?

PS - I thought at first catalog:setPropertyForPlugin would do it, but it seems to just set some invisible property, not the viewable, filterable, custom metadata kind.

Thanks,

Rob

This topic has been closed for replies.

3 replies

areohbee
areohbeeAuthor
Legend
July 14, 2010

photo:setPropertyForPlugin, not catalog:setPropertyForPlugin!

-R

areohbee
areohbeeAuthor
Legend
July 9, 2010

Oops, it was late - I was tired... - needs to be photo:setPropertyForPlugin, not catalog:setPropertyForPlugin. (Note: both those methods exist, they just do different things...)

Duh...

Thanks guyes,

Rob

johnrellis
Legend
July 9, 2010

Yeah, there are many advantages to a dynamic language like Lua, but a big disadvantage is that pretty much any string of garbage

can be executed, which makes PUI (programming under the influence) dangerous :-(

john beardsworth
Community Expert
Community Expert
July 9, 2010

Have you referenced the field value correctly. That method should work, providing you reference the plug-in correctly, that the metadata definition is present, and you have a way of seeing the results (a panel, in filter panel or smart collections)

johnrellis
Legend
July 9, 2010

To build on John's reply, double-check that the metadata definition declares the field browsable and searchable, e.g.

    metadataFieldsForPhotos = {
        {id = 'type',
         title = "Type",
         dataType = 'string',
         browsable = true,
         searchable = true},