View Single Post
Old 06-21-2019, 10:20 PM   #9
davidfor
Grand Sorcerer
davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.
 
Posts: 24,905
Karma: 47303824
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo:Touch,Glo, AuraH2O, GloHD,AuraONE, ClaraHD, Libra H2O; tolinoepos
Quote:
Originally Posted by Vaesse View Post
I have a library of comic books and graphic novels. I have created custom columns for all of the various artists that may be involved (Artist, Penciller, Inker, Colorist, Letterer, Cover) and am trying to create a different custom column (Art) that will take all of those columns and make one list of everyone involved in art for the comic.

I have figured out how to pull all the columns into Art:

Code:
{#artist}{#pencil:| & |}{#ink:| & |}{#color:| & |}{#letter:| & |}{#cover:| & |}
However, if there are multiple people in any one category, they are treated as one. I tried to use the "sublist" function, but it doesn't work the way I thought it did (never did manage to get it to actually separate items in the Art column). Also, if one artist fills more than one role, they'd be repeated in Art, which is less than ideal. And the separators aren't perfect, since if some but not all of the sub-columns are filled in, extra separators are likely to appear.

I think there's probably a better way to be doing what I'm doing, so I came here for help.
Did you create these columns as "Comma separated text, like tags, shown in the tag browser" and selected the "Contains names" checkbox? And is the column you are now creating a "Column built from other column, behaves like tags"? If so, to combine two, you could use:

Code:
{#artist:'list_union($,"{#pencil}", " & ")'}
That will give you a list of all the unique names separated by an ampersand. For more than three columns, it looks something like:

Code:
{#artist:'list_union($,list_union(field("#pencil"),field("#ink")," & "), " & ")'}
And adding more columns means nesting more "list_union"s and I'd get lost in matching the parentheses and quotes. So, I'd use program mode for and get something like:

Code:
program:
     people = list_union(field('#artist'), field('#pencil'), " & ");
     people = list_union(people, field('#ink'), " & ");
     people = list_union(people, field('#color'), " & ");
     people = list_union(people, field('#letter'), " & ");
     people = list_union(people, field('#cover'), " & ");
I haven't tested the full version as I had to add a second column for names in my test library. But, it mostly works with two columns and the rest is extrapolation of that.

This does produce an ampersand separated list. It only has each name one. The tag browser show each name separately. But, the sorting is probably not correct. I don't see a way to have them treated as names. So, the sorting will be "FN LN" rather than "LN, FN" like it would for the authors column.
davidfor is offline   Reply With Quote