Custom Metadata - Date entry, inheritance

(V3.1.1.0) I need to keep track of dates (sometimes also times) & created a Custom Metadata “Action Date” field

Now I am starting to make use of it I find it always defaults to today’s date and it’s rather tedious to click-click-click… to get the right date. (It would also be nice if metadata fields inherited as “default” values the corresponding value from their parent… then I could outline top/down without having to enter everything everywhere)

The UI is like this…
image

In Outline view I can double-click the metadata field and edit, and there I can paste date text (though there is also an unwanted time value on a date field - and the time value seems to depend on where I double click in that column, in a way I can’t quite fathom.)

image

Question

  • Are there any other, perhaps easier, ways to enter/edit esp. date/time metadata fields?
  • And is there any way so specify a “base date” so at least I don’t have to change year and month every time I want something other than today, this month?

Many thanks!

UPDATE Q
Where are the metadata values (dates) stored? (Files?) I am quite happy to hack XML etc. to expedite backfilling :wink: Thx.

Here’s a post that explains how to do date entry in the inspector without all the clicking. The Outliner should work similarly.

There is no way to inherit metadata, unfortunately, or specify a base date.

If you don’t get an answer here for this question, then create a test project, from the Blank template to keep it as simple as possible. Create a custom metadata Date field, add one document and update the value of the custom Date field. Then start poking through files in the test project’s .scriv folder until you find where the data for Custom date is stored. :nerd_face:

Best,
Jim

1 Like

Thanks @JimRac

Yes, some editing as described is possible; however I set my date format to be “Thursday, January 20, 2022” because the day of the week is important, and I also have to type the month name… but I can see there is a custom format option in Project Settings… Custom Metadata - I’ll see if I can create one that allows for quicker entry.

In the outline view the editing is only dd/mm/yyyy even though the display is as specified, so it is already easier there.

Yes :wink: I can grep the files for a unique string… just thought I’d ask in case anyone had the precise answer to hand.

Thanks, Julian

Where are the metadata values (dates) stored? (Files?) I am quite happy to hack XML etc. to expedite backfilling :wink: Thx.

They’re stored in the project’s .scrivx file.

Yes, there are bugs, quality of life and basic design details that have yet to be implemented or fixed, with custom metadata date fields. We have a big list of them already drawn up, including freeform date field entry that even allows for plain language (like typing in ‘tomorrow’), and inserting dates using the actual format mask being used. The whole calendar interface was always meant to be optional, with the text field being the primary input method. As it stands, if you accidentally double-click a date field in outliner you get stuck with a date you can’t even delete!

Until those things are fixed, I’m afraid the easiest way to work with dates in a bulk fashion is is the XML data itself, which fortunately is not difficult:

  1. As always, when modifying core data files directly, run a quick File ▸ Back Up ▸ Back Up To... and close the project.
  2. Open the project_name.scrivx file in a plain-text or XML editor.

The easiest way to find an existing date you want to copy is to search for the entry it came from by name, which will be something like this:

<Title>Name of Binder Item</Title>

Once you’ve found the BinderItem, look for a ‘./MetaData/CustomMetaData/MetaDataItem/FieldID’ that matches the data field name (sans non-alphanumeric; all lowercase). The ‘MetaDataItem/Value’ will contain the ISO standard date string in one of two formats, depending upon whether the Ignore time zone setting is ticked for the field. Here are two examples:

<CustomMetaData>
	<MetaDataItem>
		<FieldID>datewithouttimezone</FieldID>
		<Value>2022-01-20 17:37:30</Value>
	</MetaDataItem>
	<MetaDataItem>
		<FieldID>timezonedatefield</FieldID>
		<Value>2022-01-20 17:37:28 +0100</Value>
	</MetaDataItem>
<CustomMetaData>

I don’t know if worlds will explode if you provide a TZ offset on a field that doesn’t use it, or vice versa, I haven’t tested that, but if you’re just propagating data added via the UI, that shouldn’t be an issue.

Given how XML parsing works, you can add or modify full structure in parallel to any that already exists. So your script or search & replace macro could create an amendment to an item that looks like this, in excerpt:

<MetaData>
	<IncludeInCompile>Yes</IncludeInCompile>
</MetaData>
<MetaData>
	<CustomMetaData>
		<MetaDataItem>
			<FieldID>timezonedatefield</FieldID>
			<Value>2022-01-20 17:37:28 +0100</Value>
		</MetaDataItem>
	</CustomMetaData>
</MetaData>

The elements will be merged together the next time Scrivener writes the .scrivx file. That will be easier than detecting whether a CustomMetaData field has already been created for an item, anyway.

2 Likes

Thanks (also @dirkhaun ) - that’s just what I need (I already had chronology in Excel)

(I hadn’t begun to think about TZ info because then I’d be asking for a location lat/long data field so that if I moved the action to another place the time would update automatically :rofl: but then I’d want a point and click globe, historical borders, and so on, and before you know it you’d have to take into account continental drift for a time-travel back-to-the-Permian story :wink: )

2 Likes