Quote:
Originally Posted by ownedbycats
Code:
program:
bookformat =
switch_if(
'PAPERBOOK' inlist_field 'formats', 'Physical Books',
('OVERDRIVE' || 'PAPERLOAN') inlist_field 'formats', 'Loans',
'eBooks');
Test book with only a PAPERLOAN format, returns eBooks. What I do wrong?
EDIT: ('OVERDRIVE' inlist_field 'formats' || 'PAPERLOAN' inlist_field 'formats') works, was hoping to avoid repeated.
|
inlist and inlist_field have a regular expression on the left hand side. You put a boolean expression. What you want is a regular expression using alternatives.
This should work:
Code:
program:
bookformat =
switch_if(
'PAPERBOOK' inlist_field 'formats', 'Physical Books',
'OVERDRIVE|PAPERLOAN' inlist_field 'formats', 'Loans',
'eBooks');