|
|
#1 |
|
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,292
Karma: 1428263
Join Date: Dec 2016
Location: Goiânia - Brazil
Device: iPad, Kindle Paperwhite, Kindle Oasis
|
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)
|
|
|
|
|
|
#2 |
|
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,606
Karma: 28548974
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 | |
|
|
|
|
#3 |
|
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,292
Karma: 1428263
Join Date: Dec 2016
Location: Goiânia - Brazil
Device: iPad, Kindle Paperwhite, Kindle Oasis
|
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 |