Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New script idea: add date created and last edit time attributes to pages based on JSON export parsing #15

Open
GitMurf opened this issue Apr 26, 2020 · 0 comments

Comments

@GitMurf
Copy link
Owner

GitMurf commented Apr 26, 2020

Slack post with all the details:

https://roamresearch.slack.com/archives/CNC4881EU/p1587839149387900

Full details from Slack:

Mitch Yesterday at 11:25 AM
Hi everyone, is there maybe a feature that can extract "Created" and "Updated" datetime information of a page, and put it in the page itself?

Gijs 22 hours ago
Not really but have a look at roam toolkit.

Murf 21 hours ago
@Mitch I could create a script that looks at a JSON export of your DB and parses out those dates and then adds them as attributes on each page. But then would have to upload the markdown pages and choose the option to "append" to page data that is already there. Does that sound like what you are looking for?

Mitch 5 hours ago
@Murf I'm not sure what you mean by 'attributes'. To provide an idea of what I'm using right now: At the top of each dedicated page, I add some metainformation at the top (see attachment). However, I put in the start date and last edit manually (in order to make the page show up on my daily pages).
Ideally, Roam would update this automatically. However, if I could bulk-edit this information for all pages every now and then (which could be accomplished by such a script, if I understand you correctly), I'm sure that would already be a great time-saver!

image

Murf 2 hours ago
@Mitch Roam has "Attributes"...

  • see here: https://roamresearch.com/#/app/help/page/LJOc7nRiO
  • Then you can create what Roam calls "Attribute Tables"... see about halfway down the Roam help page linked above.
  • Attached screenshot is an example of what you could do to see all your pages with the "Last Edit" attribute and their dates.
  • Code for the attribute tables would be: {{attr-table: [[Last Edit]]}}

image

Murf 2 hours ago
Here is what my "Scratch work" page looks like with the attribute... you just type :: and then the attribute/page name to use "Last Edit". It then shows it as bolded and removes the second : but the code in the block actually is: Last Edit:: [[April 25th, 2020]]

image

Murf 2 hours ago
And then here is Page 2 Test...

image

Murf 2 hours ago
So what I am proposing is I could create a script that would parse out the last edit / update time and the created time and then put them in as attributes (Last Edit:: and Created::) ... for example here is what a JSON export would look like for a page named "Interference":
{"create-email":"--REDACTED--","create-time":1586311196718,"title":"Interference","edit-time":1586311196754,"edit-email":"--REDACTED--"}

So would:

  1. parse out the create-time and edit-time
  2. then convert to a real date and time value
  3. then create those two attributes and add to the page.

@Mitch Does that all make sense? And is that what you want?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant