View Single Post
Old 04-05-2023, 02:07 PM   #563
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 12,522
Karma: 8065528
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by ownedbycats View Post
I just put program: columnupdate_seriesindex(0) in the template tester and it worked. The downside is I was testing with a book I hadn't wanted to change to 0. Oh well.
Yea, that is what the template does. I didn't add a "test" mode.
Quote:
For future reference, can other called python templates update columns directly without the action chain?
Yes. However, depending on what you do you might need to do more work to update the GUI. For example, if you change a tag's name then you must update the tag browser and all the books affected by the rename. This isn't hard but it must be done.
Quote:
Additionally: Other than the formulas action, would it work if called in a SFE template mode? That way I could do an if-then.
Not as written because it operates on the entire selection. IIRC SFE is called per book, so if the template was changed to work on the current book then it should work. Two possible problems:
  • The GUI will be updated on every call so there might be some screen flashing. If SFE takes care of updating the GUI then those bits can be removed from the template.
  • SFE doesn't know how to update the series_index, so the template would do that behind its back. I don't know whether that will work reliably.
You could of course put the if/then in the Formula template that calls the python template. It would evaluate whether or not to call the stored template.
chaley is offline   Reply With Quote