Quote:
Originally Posted by ackomb
This is not me trying to be a being a wise ass but I've tested this but it's not quite working the way I wanted.
Let say that my custom_column named #ao3show contains the following items:
Code:
Bus, Car, Ferry, Ferry Terminal, Red
I've then entered your code as follows:
Code:
program:
sample_input = 'Bus, Car, Ferry, Ferry Terminal';
list = 'bus, ferry';
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, ',')
The outcome is:
Code:
Car, Ferry Terminal, Public Transport
Red is gone completely, not replaced just gone.
|
That is because 'Red' is not in the sample input.
Quote:
Whereas if I replace the list sample_input with the actual column
|
That is what I intended you to do -- to use live data I don't have.
Quote:
and add a 2nd list with tags I want to remove like this:
Code:
program:
list = 'bus, ferry';
list2 = 'Car';
output = '';
# Change $#custom_column to sample_input so the value exists, avoiding an error.
for item in $#ao3show:
if ('^' & item & '$') inlist list then ni = 'Public Transport'
elif ('^' & item & '$') inlist list2 then ni = ' '
else ni = item
fi;
output = output & ',' & ni
rof;
output = list_sort(list_remove_duplicates(output, ','), 0, ',')
The outcome is:
Code:
Ferry Terminal, Public Transport, Red
|
That is a good way to remove elements. It eliminates the need for list_intersection().
FWIW: The comment Change ... is now meaningless because you are using live data that I don't have.
Quote:
I would then use the other piece of code you helped me with to transfer "Public Transport" from #ao3show to #show, the latter only containing tags I want to keep which would leave me with the tags not mentioned in 'list' or 'list2'. This would allow me to run the action after downloading and then check the remaining tags to see whether or not I find them useful.
|
Good. I hope it works.