Skip to content

importing data from a data note #2509

Answered by zadam
jobidon asked this question in Q&A
Discussion options

You must be logged in to vote

Sure, the trivial way is to just hardcode the note ID into the script:

const dataNote = api.getNote('bMY492A20J2L'); // hardcode noteId

const json = dataNote.getJsonContent();

A nicer variant is to define a relation from your script note to the data note, e.g. ~dataNote=... and then access it like this:

const dataNote = api.currentEntity.getRelationTarget('dataNote');

const json = dataNote.getJsonContent();

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Answer selected by jobidon
Comment options

You must be logged in to vote
1 reply
@zadam
Comment options

zadam Jan 5, 2022
Maintainer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants