Quote:
Originally Posted by Noughty
Now I am editing it to remove one tag but it fails to remove a comma. So I get a list with one extra comma. I use function re and tried to simply write the tag, also tried with list_intersection., list item and so on I still remain with a comma. What function to use to remove one tag without leaving comma?
|
You are saying that list_sort without the re functions returns a list with a comma at the end? Or that 'tag' is in one or both of #genre or #character, but it is not being removed from the first list? Or that you want to unconditionally remove 'tag' from the result, even if it is not in the union of '#shelf' and 'tags'?
If it is the latter, then I would try something like the following:
Code:
program:
list_sort(
list_difference(
list_union(field('#shelf'), field('tags'), ','),
list_union(
"tag",
strcat(field('#genre'), ',',
field('#mode'), ',',
field('#character'), ',',
field('#length')),
','),
','),
0, ',')
This works by doing a union of the list "tag" and a manually constructed large list consisting of items in #genre through #length. It is OK that there might be duplicates in this constructed list, because the list_union will remove them from the final result. In the current release, only the second parameter to list_union can have duplicates. In the next release, either parameter can have duplicates.