Quote:
Originally Posted by ackomb
I'm wondering though if there is a way to make it more like this:
Code:
program:
list = 'bus, car, ferry, red'
output = '';
for item in $#cumstom_column:
if item == in list then ni = 'Public Transport'
else ni = item
fi;
output = output & ',' & ni
rof;
output = list_sort(list_remove_duplicates(output, ','), 0, ',')
|
Yes, but the syntax is different from what you wrote. Here is your template, corrected.
Code:
program:
sample_input = 'bus, carpool, ferry, redbus';
list = 'bus, car, ferry, red';
output = '';
# Change $#custom_column to sample_input so the value exists, avoiding an error.
for item in sample_input:
if ('^' & item & '$') inlist list then ni = 'Public Transport'
else ni = item
fi;
output = output & ',' & ni
rof;
output = list_sort(list_remove_duplicates(output, ','), 0, ',')
Quote:
Also, are there limitations to the elif statements within one template? I've had Calibre crash sometimes running an action chain, so I'm chopping them up in bits and pieces anyway, just want to know the limitations.
|
There is recursion in parsing so the default limit to elifs is 1000. Do you think you might go over that?