View Single Post
Old 02-22-2021, 04:10 AM   #359
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,203
Karma: 1995558
Join Date: Aug 2015
Device: Kindle
Version 1.3.0

Version 1.2.3
  • Update: Chain Variables: Add option to loop over all books per var in the table.
  • Update: Chain Variables: Right clicking value cell opens template editor.
  • Update: Add new template function book_vars to access book specific variables set by custom actions (using chain_loop.set_book_vars). They are no longer accessible from the globals template function, to provide consistent behaviour that enables set_globals to work the same everywhere.
  • Fix: Formulas: Bug with mean value when fed an empty list or a list with no numerical values. It now handles it by returning 0.

Version 1.2.4
  • Update: Selection Modifier: Add two new options: "Clear Selections", "Select first book in current view"
  • Update: Add new template function set_book_vars.
  • Update: Chain Variables: Guarantee order of processing of variables is same as order in table.
  • Update: Chain Variables: Double clicking value cell will open template dialog if value start with "program:"

Version 1.3.0
  • Update: Add new template function: category_items().
  • Update: Chain Variables: Double clicking the value cell always opens the formula dialog.
  • Fix: from_selection() and from_search() formulas always return a constant list of 1,2,3,4,5 when in any template dialog, not just in the formula dialog.

This is how to use the new category_items() template function:

Code:
program:
    category_items('#genre')
This would return all the #genre tags. You can replace #genre with any other category like tags, authors .... etc

It can also take second optional arg to limit the result to set of book_ids

Code:
program:
    book_ids = from_selection('id');
    category_items('#genre',book_ids)
from_selection() can be replaced with from_search() to achieve the same result.

The resulting items are separated by one of the following characters(s):
  1. If the category contains names like the author field, the items are separated with ' & '.
  2. If the category is a field that accepts multiple items like tag, the items are separated with ', '
  3. If the category is a field that only accepts one value like series, the items are separated with ' ::: '. This is necessary because fields like series can contain commas AND/OR ampersands.

Also note that the previously intoduced book_vars() template function is now used to access book specific variables, instead of the old way of accessing them using the globals function. The both work differently; book_vars() requires you to pass an expression that is usually a constant string. The globals() function require that the arguments be variable names. This can be illustrated by the following examples:

Code:
program:
    globals(my_var)
Code:
program:
    book_vars('my_var')
capink is offline   Reply With Quote