08-25-2019, 06:47 PM | #1 |
Guru
Posts: 927
Karma: 1177583
Join Date: Dec 2016
Location: Goiânia - Brazil
Device: iPad, Kindle Paperwhite
|
Set a value to a custom column inside a plugin
Hi everyone.
I'm trying to set a value to a custom column, but got stuck. Here is what I got: Code:
mi = db.get_metadata(book_id) mi.set_user_metadata(#percentage, progress) According to the Manual, I should use: Code:
set_user_metadata(field, metadata) |
08-25-2019, 11:21 PM | #2 |
creator of calibre
Posts: 43,850
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
Assuming percentage is a numeric field it should be fine. But if what youwant to do is set it in the custom column in the database, the way to do it is like this:
db.new_api.set_field('#percentage', {book_id: value}) |
Advert | |
|
08-27-2019, 05:48 PM | #3 |
Guru
Posts: 927
Karma: 1177583
Join Date: Dec 2016
Location: Goiânia - Brazil
Device: iPad, Kindle Paperwhite
|
Thanks, Kovid.
That worked. |
Tags |
custom columns, metadata |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
How to set value of custom column automatically? | steins | Plugins | 5 | 12-27-2018 03:23 AM |
Set default value of a custom column | laszlopanaflex | Library Management | 2 | 12-01-2018 02:54 PM |
How to set the number of decimals in a custom column | sekhemty | Library Management | 3 | 04-28-2017 09:06 AM |
Set Custom Column from identify.py | ahisham | Development | 6 | 02-05-2015 09:53 AM |
Using OnDevice to set the value of a custom column | WendyR14 | Library Management | 3 | 10-23-2011 08:03 PM |