Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Library Management

Notices

Reply
 
Thread Tools Search this Thread
Old 04-12-2016, 07:42 PM   #1
Jade Aislin
Groupie
Jade Aislin could sell banana peel slippers to a Deveel.Jade Aislin could sell banana peel slippers to a Deveel.Jade Aislin could sell banana peel slippers to a Deveel.Jade Aislin could sell banana peel slippers to a Deveel.Jade Aislin could sell banana peel slippers to a Deveel.Jade Aislin could sell banana peel slippers to a Deveel.Jade Aislin could sell banana peel slippers to a Deveel.Jade Aislin could sell banana peel slippers to a Deveel.Jade Aislin could sell banana peel slippers to a Deveel.Jade Aislin could sell banana peel slippers to a Deveel.Jade Aislin could sell banana peel slippers to a Deveel.
 
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}
But the results I got were:
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?
Jade Aislin is offline   Reply With Quote
Old 04-13-2016, 03:19 AM   #2
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
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'))
You end up with "BtVS.YYH.Xander, BtVS.YYH.Yusuke".
chaley is offline   Reply With Quote
Advert
Old 04-13-2016, 04:54 PM   #3
Jade Aislin
Groupie
Jade Aislin could sell banana peel slippers to a Deveel.Jade Aislin could sell banana peel slippers to a Deveel.Jade Aislin could sell banana peel slippers to a Deveel.Jade Aislin could sell banana peel slippers to a Deveel.Jade Aislin could sell banana peel slippers to a Deveel.Jade Aislin could sell banana peel slippers to a Deveel.Jade Aislin could sell banana peel slippers to a Deveel.Jade Aislin could sell banana peel slippers to a Deveel.Jade Aislin could sell banana peel slippers to a Deveel.Jade Aislin could sell banana peel slippers to a Deveel.Jade Aislin could sell banana peel slippers to a Deveel.
 
Posts: 164
Karma: 3100
Join Date: Sep 2011
Device: Kobo Auro H2O, PRS-T1
Quote:
Originally Posted by chaley View Post
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. The second code line adds that prefix to each item in the #character list, separated by a period.
I had the feeling that it would be more complicated, but I wasn't sure how to do it. I had looked at 'list' functions, but I couldn't figure which one to use or how to use it.

Your code worked. Thank you.
Jade Aislin is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
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


All times are GMT -4. The time now is 10:36 PM.


MobileRead.com is a privately owned, operated and funded community.