|
![]() |
|
Thread Tools | Search this Thread |
![]() |
#1 |
Enthusiast
![]() Posts: 48
Karma: 10
Join Date: Sep 2014
Device: ipad air
|
need custom column built from other cols, behave like tags but with author-like separ
I've created a very useful custom column (built from other columns) that hold canonicalized author names: it works great (I used author links to hold the canonical form of any given name, and then this regex: {:'list_re(author_links(":", " & "), " & ", ".*?([^:]+):?$", "\1")'}). All is good, except that I had to use the "built form other columns" type rather than the "built from other columns, behaves like tags" type because the names may contain commas, which causes havoc with the tag-like behaviour. But as a result, when I look at my new category in the tag browser, it doesn't behave like a list: for multiple authors I see single entries such as "bob & jane & clare". So what I believe I need (but can't find) is a way to create a custom column that is "built from other columns" and "behaves like authors". I do see that if I create a "comma-separated text, like tags" custom column then I can set "contains names", which seems to do what I want (ie. make the separator & rather than ",") but is it possible to get that behaviour from the "built from other columns, behaves like tags" type? (ie. ampersands rather than commas as separator).
Thanks! Mike |
![]() |
![]() |
![]() |
#2 |
Enthusiast
![]() Posts: 48
Karma: 10
Join Date: Sep 2014
Device: ipad air
|
To be more clear: does anyone know if it's possibly to create a composite column that uses '&' rather than ',' as its list separator?
|
![]() |
![]() |
Advert | |
|
![]() |
#3 |
null operator (he/him)
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 21,677
Karma: 29711016
Join Date: Mar 2012
Location: Sydney Australia
Device: none
|
Your thread shows its been viewed 70+ times. So it's probably safe to assume none of those viewers know if it's possible to do what you want.
If you state why you want a such a composite column, i.e. what problem are you trying to solve, you might get some answers. BR |
![]() |
![]() |
![]() |
#4 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,376
Karma: 8012652
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
No, it isn't possible. Composite columns always use a comma as a separator. That won't change, especially because the "&" implies item order as well as the separator.
|
![]() |
![]() |
![]() |
#5 |
hopeless n00b
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 5,110
Karma: 19597086
Join Date: Jan 2009
Location: in the middle of nowhere
Device: PW4, PW3, Libra H2O, iPad 10.5, iPad 11, iPad 12.9
|
Just a thought. If the contents of the composite column doesn't change frequently, perhaps instead of a composite column, you can instead create a custom authors column and use bulk search & replace to copy the template result to the custom authors column.
|
![]() |
![]() |
Advert | |
|
![]() |
#6 |
Enthusiast
![]() Posts: 48
Karma: 10
Join Date: Sep 2014
Device: ipad air
|
Thanks for the replies:
@chaley: thanks for the definitive answer: I figured it was not possible, but I just wanted to rule it out before I gave up on that solution. @BetterRed: the reason is that I've created a composite column that is a mapping of author names to canonical author names (via a lookup table that's implemented as the "author link" column under "manage authors"). That part works fine: the new column holds all the author names, and they've all been canonicalized where necessary. But I then wanted to be able to view those (canonical) authors under the tag browser: however, if I retain "&" as a separator (which is what I was hoping I could do) then the individual names are lumped together as a simple string (eg. "bob & jane & clare" is treated as if it was a single author's name) and if I use "," as a separator then the names are split out individually as I want, but also any additional commas cause extra (bogus) splitting (eg. "Lloyd Biggle, Jr." becomes two authors: "Lloyd Biggle" and "Jr."). So I'm at a loss as to how to achieve the tag-like behaviour (canonical author names being split out in the tag browser) without having to eliminate the use of commas in my authors column (which seems like an ugly workaround). I was hoping that I could select something like "contains names" and have the composite column output treated as an ampersand-separated list, but that is apparently not possible. Any other solutions to this problem are welcome, naturally ![]() @ilovejedd: thanks for the suggestion: it would be a good workaround, but the column does change fairly often: whenever I add a new book or article, or whenever I clean up the authors on existing books (which happens fairly often still because I didn't take a lot of care when I started adding books!). Last edited by masp; 11-04-2018 at 07:41 PM. Reason: fixing typos |
![]() |
![]() |
![]() |
#7 | |
hopeless n00b
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 5,110
Karma: 19597086
Join Date: Jan 2009
Location: in the middle of nowhere
Device: PW4, PW3, Libra H2O, iPad 10.5, iPad 11, iPad 12.9
|
Quote:
|
|
![]() |
![]() |
![]() |
#8 |
Enthusiast
![]() Posts: 48
Karma: 10
Join Date: Sep 2014
Device: ipad air
|
Thanks: I'll look into it. It is a shame that composite columns can't share the "contains names" feature along with the "comma-separated text like tags" columns: that would be perfect! I wonder if it's a code limitation or a philosophical limitation?
|
![]() |
![]() |
![]() |
#9 | ||
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,376
Karma: 8012652
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
Two examples of library closed plugins: Save Composite Custom Columns and Save Virtual Libraries To Column Quote:
Both the Author columns and "Contains names" columns enforce ordering, ensuring that the authors always appear in the order they were originally listed. When custom columns were developed, comma-separated lists did not enforce order; a fetched list could have a different order from the originally stored list. As of calibre 3, all multiple fields enforce order, but no changes were made (see next issue). More to the philosophical side: compatibility. Adding & as a separator would break anything that processes the list as text or constructs text from the list. For me, the benefit does not justify the pain. |
||
![]() |
![]() |
![]() |
#10 | |
hopeless n00b
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 5,110
Karma: 19597086
Join Date: Jan 2009
Location: in the middle of nowhere
Device: PW4, PW3, Libra H2O, iPad 10.5, iPad 11, iPad 12.9
|
Quote:
|
|
![]() |
![]() |
![]() |
#11 | |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,376
Karma: 8012652
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
For each book in the library:
|
|
![]() |
![]() |
![]() |
#12 |
Enthusiast
![]() Posts: 48
Karma: 10
Join Date: Sep 2014
Device: ipad air
|
Thanks @chaley: out of curiosity, how does the parsing work with the "comma-separated text like tags" column when "contains names" is selected? That does get parsed as a list (as indeed does the authors column), despite (or indeed due to) having ampersand as separator: ie. if I enter "bob & jane" then I see "bob" and "jane" as separate entities in the tag browser. I had hoped that because that column type could be split on "&" (with the "contains names" option selected) then so could the "behaves like tags" composite column (if that same option was available in that context).
|
![]() |
![]() |
![]() |
#13 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 24,905
Karma: 47303824
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo:Touch,Glo, AuraH2O, GloHD,AuraONE, ClaraHD, Libra H2O; tolinoepos
|
How about changing the comma in the names to something else? Ideally, a character that looks like a comma, but, calibre won't treat as a comma. I'm to lazy to work out the best character, so I've done this with an "@"
Code:
{:'re(list_re(re(author_links(":", " & "),",","@"), " & ", ".*?([^:]+):?$", "\1"),"&",",")'} |
![]() |
![]() |
![]() |
#14 |
Enthusiast
![]() Posts: 48
Karma: 10
Join Date: Sep 2014
Device: ipad air
|
Yes that's a good idea: some unicode character that indistinguishable from a comma. Assuming "contains names" is not going to become available for composite columns, that's the best suggestion (for my use case) I've seen! Thanks!
|
![]() |
![]() |
![]() |
#15 | |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,376
Karma: 8012652
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
Composite columns are not stored at all, but are computed on demand. If a list is needed then the template result is split at the separator, hard-coded as a comma. Introducing a variable separator would introduce the requirement that all list use sites to check the column description or they could break. I have no idea how many external tools, plugins, or the like would break, but I am sure it is a lot of them. |
|
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Custom column built from word count column | Montana Harper | Library Management | 3 | 10-04-2018 09:57 PM |
A custom column built from other columns: simple math operations | Joanna | Calibre | 26 | 06-07-2016 04:35 AM |
Crash when adding a custom (built) column | MidwestJen | Library Management | 13 | 12-06-2014 03:52 PM |
Date custom column built from a Y/N one? | glos | Library Management | 3 | 08-25-2013 12:48 PM |
Custom yes/no column built from long text column | Philantrop | Library Management | 7 | 03-23-2013 07:44 PM |