Thank you for this. I think that these additions increase flexibility, allowing someone to solve a problem the way they think about it.
Quote:
Originally Posted by capink
- Update: Chain Variables: Add option to loop over all books per var in the table.
|
Question: is the order of evaluation guaranteed to be the order of the vars in the table? In other words, can the template for second variable be sure that the first variable has been defined?
Suggestion: move the "Iterate" checkbox to the second column. It took me a while to find it. I didn't think of scrolling.
Quote:
Originally Posted by capink
- Update: Chain Variables: Right clicking value cell opens template editor.
|
Is it reasonable to open the template editor on double-click if the value starts with "program:"?
Quote:
Originally Posted by capink
- 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 behavior that enables set_globals to work the same everywhere.
|
Is it reasonable to add a template function set_book_vars(), perhaps only in chain variable templates?
A note: book_vars() (and a possible set_book_vars()) uses a different syntax than globals() and set_globals(). book_vars() requires you to pass an expression that is usually a constant string. The globals() and set_globals() functions require that the arguments be variable names; they cannot be expressions. I think this difference is confusing.
I don't see a way to unify the syntax of book_vars() and globals() other than by changing the formatter to return the variable name as a string if that variable isn't defined. If I did that then book_vars(aaa) would be identical to book_vars('aaa'). On the other hand the following template would return the book title instead of raising an undefined variable error:
Code:
program:
field(title)
The following template would also work, producing the result 'hello there' as long as the variables 'hello' and 'there' are undefined.
Code:
program:
strcat(hello, ' ', there)
Is this a good thing or a bad thing? I am leaning toward 'good' but I am concerned about 'mysterious behavior'. For example, the following template returns 'foo there' because 'hello' has been assigned the value 'foo'.
Code:
program:
hello = 'foo';
strcat(hello, ' ', there)
Final and unrelated question: I am having trouble understanding "Selection options" in Selection Modifier. What if I don't want any of the 3 choices? For example, if I do a search then I want to select the books returned by that search. I don't want the results modified at all, but there isn't a radio button "Don't change selection".
Perhaps I am overthinking it, but it seems to me that the three "groups" in the dialog are executed in order. VLs are cleared if that box is checked, a search is done (or not), resulting in selected books, and then the options are applied.