View Single Post
Old 04-11-2021, 07:44 AM   #509
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,501
Karma: 8065348
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by Terisa de morgan View Post
I have a question, because I cannot grab all the concepts here. I want that, inside of an action chain, one of the actions only applies to books with a custom column not set or set to False. Is is possible with the current plugin? I'm sure that, if I study all the information, I will get the answer, but this is one of those situations where I prefer to ask for a summary

It is certainly possible. Exactly how depends on what you want the action to do.

Assuming the action you want to run supports scopes, the simple approach is to apply a "Basic Scope" / "Act on books resulting from a search" to the action. The search would be "not #column:yes", which finds books with False or not set. The action applies to all books that match the search.

Another way to do it that is more general would be to use a "Chain Variables" action to do the computation(s) and set book variables for the metadata you want to change. The ChainVars action would process the books you want using selections or searches or whatever. Inside that action I would use two book_vars per field you want to change (#field), one saying providing the value to store (field_value) and another saying a value has been provided (field_value_provided). In this example, 'field' is the lookup name without the '#' as in 'genre_value' and 'genre_value_provided'.

You would then use Single Field Edit that would
  1. Fetch the current value of the field into (for example) the variable "result"
  2. Check the book var 'field_value_provided to see if there is a computed value. If so then "result = book_vars('field_value')"
  3. Return whatever is in "result". Action Chains checks if the returned value equals the current value and does nothing if so.
You can avoid 'field_value_provided' if you can guarantee that the value is never empty.

EDIT: Ninja'ed by capink. But it was fun to think about it.
chaley is offline   Reply With Quote