View Single Post
Old 07-16-2022, 03:10 PM   #8
ackomb
Zealot
ackomb has a spectacular aura aboutackomb has a spectacular aura aboutackomb has a spectacular aura aboutackomb has a spectacular aura aboutackomb has a spectacular aura aboutackomb has a spectacular aura aboutackomb has a spectacular aura aboutackomb has a spectacular aura aboutackomb has a spectacular aura aboutackomb has a spectacular aura aboutackomb has a spectacular aura about
 
Posts: 106
Karma: 4486
Join Date: Mar 2020
Location: Netherlands
Device: i-pad
Quote:
Originally Posted by chaley View Post
@ackomb: If I came across as critical or negative then I am sorry. I really like it when people try and I am glad to help. We both end up learning something.
No worries, I didn't think you were critical or negative, just confused as you said. I figured at some point I would get OFF Topic to much but by then I started already and didn't know how to move it.

So I guess my code will go from here adding elif's when needed
Code:
program:
	output = '';
	for item in $#cumstom_column:
		if  	  item == 'bus' then ni = 'Public Transport'
		elif  	  item == 'car' then ni = 'Public Transport'
		elif  	  item == 'ferry' then ni = 'Public Transport'
		elif  	  item == 'red' then ni = 'Public Transport'
		else ni = item
		fi;
		output = output & ',' & ni
	rof;
	output = list_sort(list_remove_duplicates(output, ','), 0, ',')

Input:
Code:
Bus, Car, Ferry, Ferry Terminal, Red
Result Output:
Code:
Ferry Terminal, Public Transport
Originally I thought that the list_intersection was a way to create a list of items you wanted to use in the next line as a val the way 'a' worked in list_union in:

Code:
program:
	a = list_intersection($#cumstom_column_a, 'tram, train, bus, ferry', ',');
	list_union($#cumstom_column_b, a, ',')
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, ',')
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.
ackomb is offline   Reply With Quote