View Single Post
Old 03-02-2022, 02:56 PM   #11
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: 11,773
Karma: 7029857
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
@davidfor: looking again at the code, I now think I was being way too pessimistic about using templates. If you add the checkbox you suggested then:
  • If the box isn't checked then "collection_attributes" is set to the contents of the box as is done today.
  • If the box is checked then collection_attributes is set to something like "template", which cannot otherwise appear because there is no standard lookup name 'template'.
  • When getting the values for a "collection attribute" (a lookup name), if the name is "template" then get the list of values from the template, otherwise from the column.
  • The rest of the processing is unchanged.
This idea leaves open the possibility of intermixing values from columns (lookup names) and results of a template. If instead of the checkbox you add a template box then the code could process any keys in the standard box then process the results of the template. Doing this would support using 'standard' values unchanged along with adding 'custom' values without using custom columns.

Apologies for being a bit dense.

EDIT: if you want me to send you proof-of-concept code for the above, let me know. It is a small change from what I have already done.

Last edited by chaley; 03-02-2022 at 03:00 PM.
chaley is offline   Reply With Quote