Highlighted

How to Create a Custom Metadata Date field

Explorer ,
Jun 03, 2020

Copy link to clipboard

Copied

I have been using the SDK information, and have successfully added custom data fields using data type = String and enum

I would like to add a date field that will display as a date in the Library search field. 

 

I have been using just a string to hold the date, but it is treated as text in search. 

 

Is there a data type when defining your fields for a date / time? 

 

Is this just a matter of formatting? 

 

Your help is appreciated.  

Most Valuable Participant
Correct answer by johnrellis | Most Valuable Participant

The SDK allows just three types: "string", "enum", and "URL". It doesn't provide any mechanism for controlling how they are displayed. So if how the value is displayed is important, you'll need to store string values in the format you want users to see them.  There have been requests for years to expand the metadata capabilities of plugins:

https://feedback.photoshop.com/photoshop_family/topics/lightroom_sdk_support_all_data_types_in_custom_metadata

 

Plugs do have one minor way to control the display of custom metadata fields in tagsets -- they can tell LR to use multiple lines for displaying string values and allow newlines on input:

 

{'com.adobe.caption', height_in_lines = 15, allow_newlines = true,  topLabel = true}

 

(I assume you've read Chapter 4 of the Lightroom Classic Programmers Guide.)

TOPICS
How to, SDK

Views

429

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

How to Create a Custom Metadata Date field

Explorer ,
Jun 03, 2020

Copy link to clipboard

Copied

I have been using the SDK information, and have successfully added custom data fields using data type = String and enum

I would like to add a date field that will display as a date in the Library search field. 

 

I have been using just a string to hold the date, but it is treated as text in search. 

 

Is there a data type when defining your fields for a date / time? 

 

Is this just a matter of formatting? 

 

Your help is appreciated.  

Most Valuable Participant
Correct answer by johnrellis | Most Valuable Participant

The SDK allows just three types: "string", "enum", and "URL". It doesn't provide any mechanism for controlling how they are displayed. So if how the value is displayed is important, you'll need to store string values in the format you want users to see them.  There have been requests for years to expand the metadata capabilities of plugins:

https://feedback.photoshop.com/photoshop_family/topics/lightroom_sdk_support_all_data_types_in_custom_metadata

 

Plugs do have one minor way to control the display of custom metadata fields in tagsets -- they can tell LR to use multiple lines for displaying string values and allow newlines on input:

 

{'com.adobe.caption', height_in_lines = 15, allow_newlines = true,  topLabel = true}

 

(I assume you've read Chapter 4 of the Lightroom Classic Programmers Guide.)

TOPICS
How to, SDK

Views

430

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Jun 03, 2020 0
Most Valuable Participant ,
Jun 03, 2020

Copy link to clipboard

Copied

The SDK allows just three types: "string", "enum", and "URL". It doesn't provide any mechanism for controlling how they are displayed. So if how the value is displayed is important, you'll need to store string values in the format you want users to see them.  There have been requests for years to expand the metadata capabilities of plugins:

https://feedback.photoshop.com/photoshop_family/topics/lightroom_sdk_support_all_data_types_in_custo...

 

Plugs do have one minor way to control the display of custom metadata fields in tagsets -- they can tell LR to use multiple lines for displaying string values and allow newlines on input:

 

{'com.adobe.caption', height_in_lines = 15, allow_newlines = true,  topLabel = true}

 

(I assume you've read Chapter 4 of the Lightroom Classic Programmers Guide.)

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jun 03, 2020 0
Explorer ,
Jun 03, 2020

Copy link to clipboard

Copied

My main focus is being able to create a date field for 2 reasons: 
1. Be able to use the field or fields for date calculations
2. Be able to search with the date hierarchy versus just a flat query like text fields. 

I believe I can parse the info to do calculations from the text field, but was hoping for something easier. 

 

And yes I have been through the manual, as well as other lua resources. 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jun 03, 2020 0
Most Valuable Participant ,
Jun 03, 2020

Copy link to clipboard

Copied

In some of my plugins, I've created two fields, once that's hidden and in a format that's easy to parse, and one that's visible and nicely formatted for display to users.

 

[Use the blue reply button under the first post to ensure replies sort properly.]

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jun 03, 2020 1