![]() |
#1 |
Groupie
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 164
Karma: 3100
Join Date: Sep 2011
Device: Kobo Auro H2O, PRS-T1
|
composite columns only effect part of data
I have a custom column (#characters) that I want to add another custom column (#fandom) data to the beginning of.
ie. if the character column has Xander, Yusuke, and the fandoms are BtVS, YYH, I want to see BtVS.Xander and YYH.Yusuke. I would settle for BtVS.YYH.Xander, BtVS.YYH.Yusuke, as calibre won't know which character belongs to which fandom and I can edit to the correct fandom later. I thought that I could create a composite column to get the BtVS.YYH.Xander result and then copy it to the character column. However, it is not giving me the result I expected. I used the template: Code:
{#fandom}.{#characters} BtVS, YYH.Xander, Yusuke I'm not sure why it's only changing some of the data. Is there something I can do to get the results I want? |
![]() |
![]() |
![]() |
#2 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,380
Karma: 8012652
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
The template you used appends one column to another. What you want is more complicated, appending each value in column 2 (#characters) to a processed version of column 1 (#fandom}.
This template does what I think you are asking for. The first code line generates the new prefix from the fandom column by replacing all commas-followed-by-spaces with a period. "BtVS, YYH" becomes "BtVS.YYH". The second code line adds that prefix to each item in the #character list, separated by a period. Code:
program: fd = re(field('#fandom'), ', *','.'); list_re(field('#characters'), ',', '(.*)', strcat(fd, '.', '\1')) |
![]() |
![]() |
Advert | |
|
![]() |
#3 | |
Groupie
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 164
Karma: 3100
Join Date: Sep 2011
Device: Kobo Auro H2O, PRS-T1
|
Quote:
Your code worked. Thank you. ![]() |
|
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
[Library Closed Plugin] Save Composite Custom Columns | chaley | Plugins | 22 | 04-11-2020 07:09 AM |
Color coding and designing composite columns | ElMiko | Library Management | 12 | 01-04-2015 08:55 PM |
Composite column problem combining two tag type columns | At_Libitum | Recipes | 1 | 08-29-2013 12:31 PM |
using templates/pyhon and custom columns to extract specific data from tags | smoothrolla | Library Management | 6 | 11-10-2011 05:12 PM |
composite custom columns sorted numerically | Doug-W | Library Management | 2 | 02-18-2011 02:16 AM |