Things I have tried
I tried to add this function
createDifference() into my
dataviewjs block but I get the
Evaluation Error: SyntaxError: Unexpected token '&' error as seen in the attached screenshot.
When I remove this function definition I don’t get any error, the Obsidian Graph view renders fine (of course with the problem that the 2nd data set is not defined).
I can’t figure out what’s the syntax problem here?!
What I’m trying to do
I’m trying to add this function to the
dataviewjs block so that I can calculate the differences array I’d like to add to the Obsidian Graph view.
Any help much appreciated, @joethei …?!
Wow a syntax error about a character that does not exist in your code, that seems frustrating!
A couple thoughts for investigation:
- can you narrow down the line in the function that causes it? E.g. do you still get the error if you comment out the unshift line? Or part/all of the push line?
- if you put the code into the Obs developer console using
DataviewAPI. in place of
dv. does it work there?
Thanks, @scholarInTraining, for the suggestions.
I solved it!
What did I do? I deleted the function and retyped it all again.
Truth be told, I copy-pasted a part of that code from the web browser and it seems that at least one quirky character slipped in that cannot be seen inside a code block (or inside of Obsidians text editor at all). I wish there was an option to “show all characters, even the hidden ones” like there is in some editors.
I was able to insert the 2nd dataset.
Maybe interesting for you, too, @snowbiker100?!
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.