Inconsistent Notes Count On Export All

Bug report

Environment

  • Platform:
  • Platform version:
  • App Version:

How to reproduce

I tried on my 2016 MacBook Pro and had similarly inconsistent results.

Hi Chris,

Thanks for the report.
Can you tell me which notes don’t get exported? I need to reproduce it.

I wish i could but the only way i can think of would be to verify of my 2800 exported files against a note in Inkdrop.

The export all notes functionality is provided by the export-as-markdown plugin as far as I am aware. The plugin does not export empty notes, so maybe the difference matches up with the amount of notes you have that contain no content in the body.

It is also worth noting that the item count seems to be the same on both Mac and Windows, even though they appear different, as Mac only shows the total item count while Windows splits it into folders and files.

If you want to check if the count matches with the number of notes with empty body content you should be able to run the following statement in the Inkdrop developer console

(await db.notes.all({ limit: 3000 })).docs.filter((e) => e.body).length

to get the total count of notes with a non-empty body, or

(await db.notes.all({ limit: 3000 })).docs.filter((e) => !e.body)

to get all the notes with empty body if you want to cross-check your exported notes.

1 Like

That may explain what is happening. If so, its unfortunate the “Export → All Notes” does not actually export all notes thus dashing the exectation set forth by hte name. Perhaps “Export → Notes with Content”.

For this specific use case ive assimilated notes from multiple sources but now they all need a bulk edit which can easily be done outside of inkdrop and then re-imported.

I did try one of the two commands sent previously but i get an error message.

Uncaught ReferenceError: db is not defined
    at <anonymous>:1:1
(anonymous) @ VM382:1

It did occur to me that Inkdrop uses Sqlite and that i might be able to edit a record whose body field was empty or null. Using Navicat i was easily able to isolate 343 “Empty notes” and add a simple string in hope of alleviating the export issue. After restarting INdrop i noticed that the body of the note didn’t contain the simple text i added to the db field. Seems the data exchange is one directional.

But… i was able to use Inkdrop’s search functionality to query for the simple string i added. Fortunately, I was provided a list of the 343 records i found in sqlite. I then just added the simple text to each note manually.

Finally, the export counts still do not add up. Currently i have 2777 note in Inkdrop. Exporting before edit sqlite produced 2479 notes. Summing 2479 + 343 results in 2882 records not 2777.

While the inconsistency is troubling, I guess as long as i can export all, bulk edit and then reimport all everything is ok.

All in all, i love Inkdrop!

1 Like

Oh yeah that is my bad, copied that wrong command db should have been inkdrop.main.dataStore.getLocalDB() so the full commands should have been

(await inkdrop.main.dataStore.getLocalDB().notes.all({ limit: 3000 })).docs.filter((e) => e.body).length

and

(await inkdrop.main.dataStore.getLocalDB().notes.all({ limit: 3000 })).docs.filter((e) => !e.body)

But it will probably give you the same results as what you found with SQLITE so not sure about that, but might be worth still giving them a try

These commands worked Magnus and returned expected results. I think we can close this unless you think otherwise.

Thanks all for the quick responses!
Chris Hildebran

Whoa, what a thoughtful discussion. Thanks for the assistance, @Magnus.
@anon58222816, that’s a good point. Inkdrop uses SQLite but it’s solely for full-text search. You have to use the data store API to update notes.
As @Magnus pointed out, it should export notes with an empty body as well.
I’ll fix it!

v5.5.2 is out!