View Single Post
Old 12-30-2020, 12:17 PM   #228
capink
Wizard
capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.
 
Posts: 1,199
Karma: 1995558
Join Date: Aug 2015
Device: Kindle
Quote:
Originally Posted by ownedbycats View Post
Small idea:

I can see several uses for an "add/remove specified amount" to Single Field Edit > Integer-type, e.g. a column tracking how many times the book's been read. Possibly can already done via template though.

I'm not planning anything requiring its use in the near future, but something to consider.
As you said yourself, this is what the template option is for. That is why I don't think it is worth adding it. You can do it with the following one line:

Code:
program:
    add(re(raw_field('#my_int_column'), 'None', 0), 1)
The number in blue is the increment.

Update: As of calibre 5.13, template language supports several operator types including arithmetic operators. So people using calibre version >= 5.13 can replace the above code with this:

Code:
program:
    re($$#testint,'None','0') + 1

Last edited by capink; 05-03-2021 at 08:19 PM.
capink is offline   Reply With Quote