Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Recipes

Notices

Reply
 
Thread Tools Search this Thread
Old 08-21-2013, 01:19 PM   #1
At_Libitum
Addict
At_Libitum ought to be getting tired of karma fortunes by now.At_Libitum ought to be getting tired of karma fortunes by now.At_Libitum ought to be getting tired of karma fortunes by now.At_Libitum ought to be getting tired of karma fortunes by now.At_Libitum ought to be getting tired of karma fortunes by now.At_Libitum ought to be getting tired of karma fortunes by now.At_Libitum ought to be getting tired of karma fortunes by now.At_Libitum ought to be getting tired of karma fortunes by now.At_Libitum ought to be getting tired of karma fortunes by now.At_Libitum ought to be getting tired of karma fortunes by now.At_Libitum ought to be getting tired of karma fortunes by now.
 
Posts: 265
Karma: 724240
Join Date: Aug 2013
Device: KyBook
Composite column problem combining two tag type columns

Hi all,

I've a custom column 'Collection' which I use to indicate the main genre of the book. I currently 'abuse' the Tags column mostly for sub-genre's but am also using it to assign true tag categories although I might decide to splice the sub-genre's off into a true sub-genre column.

And then I discovered the "Categories with hierarchical items" trick

I have been playing with this a bit by creating a composite column combining the Collection and Tag columns and adding it as a category, using a template (first attempt -> {#collection}{tags:|.|} ). However, I ran into a snag. I was expecting/hoping the composite column to be populated with all combinations of the current values but soon found I was expecting too much magic

So here's the kicker. For instance the tag for a book has as value "adventure, lost world, time warp", and in the Collection column I have as value "Fantasy"

What I was hoping, and since then have been trying in vain to create, is that the resulting values for the composite column would be created like this

"Fantasy.adventure, Fantasy.lost world, Fantasy.time warp" (what I was hoping for)

Instead it comes out as:

"Fantasy.adventure, lost world, time warp" (what it obviously ended up creating)

Which is exactly as the template specified as I only realized after seeing the result.

Now, I've been going through the help file, manual, the forum, DuckDuck, but without getting any nearer to a solution, and at the point where outside assistance would be most welcome.

I would dearly like some help in putting together a template for a composite column build from two columns each containing tag like values so the result would be something like

"Fantasy.adventure, Fantasy.lost world, Fantasy.time warp"
And since I expect that the need will arise anyways, my "Collection" column is likely going to be containing more than the one main genre for a given book, so what I am after is something that can take the following input:

Collection field: "Fantasy, Science Fiction"
Tags field: "adventure, lost world, time warp"

and the output:

"Fantasy.adventure, Fantasy.lost world, Fantasy.time warp, Science Fiction.adventure, Science Fiction.lost world, Science Fiction.time warp"

To be used in a composite column, which I've added as category to the tag browser. Sadly, somewhat over a year ago I suffered a stroke, and since then have a lot of problems trying to learn new things, it'll sink in eventually but I find I need to look at lots more hands-on examples for it to stick, so if you know a solution, a bit more info than just pointing out which functions I need to use is very much appreciated. (I've got the feeling that this needs to be solved not by a single-... template but by something using the keyword program:' ?) but I can't find any example showing how I would create combinations of all of the values in two columns containing tag like data.

...I do love how using my custom Collection column as field to create the tabs above the library view also filters the values shown in the hierarchical view of my first attempt. It's like putting several layers of filters on top of each other
At_Libitum is offline   Reply With Quote
Old 08-29-2013, 12:31 PM   #2
At_Libitum
Addict
At_Libitum ought to be getting tired of karma fortunes by now.At_Libitum ought to be getting tired of karma fortunes by now.At_Libitum ought to be getting tired of karma fortunes by now.At_Libitum ought to be getting tired of karma fortunes by now.At_Libitum ought to be getting tired of karma fortunes by now.At_Libitum ought to be getting tired of karma fortunes by now.At_Libitum ought to be getting tired of karma fortunes by now.At_Libitum ought to be getting tired of karma fortunes by now.At_Libitum ought to be getting tired of karma fortunes by now.At_Libitum ought to be getting tired of karma fortunes by now.At_Libitum ought to be getting tired of karma fortunes by now.
 
Posts: 265
Karma: 724240
Join Date: Aug 2013
Device: KyBook
for those interested, this is what I came up with after 8 days of struggling...

program:
frst = template('{tags:sublist(0,1,\,)}');
scnd = template('{tags:sublist(1,2,\,)}');
thrd = template('{tags:sublist(2,3,\,)}');
frth = template('{tags:sublist(3,4,\,)}');
a = test(frst, strcat(field('#collection'), ".", frst), field('#collection'));
b = test(scnd, strcat(", ", field('#collection'), ".", scnd), "");
c = test(thrd, strcat(", ", field('#collection'), ".", thrd), "");
d = test(frth, strcat(", ", field('#collection'), ".", frth), "");
strcat(a, b, c, d);

#collection contains the main genre, tags the subgenres, output placed in new custom column
At_Libitum is offline   Reply With Quote
Advert
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Set value of another column from composite? dirgeon Library Management 1 02-03-2013 11:40 AM
[Custom Column - Composite] Template Help Requested Ealdwulf Library Management 2 06-16-2012 04:58 AM
Composite column or not ? Bertrand Library Management 3 08-24-2011 01:27 AM
composite custom columns sorted numerically Doug-W Library Management 2 02-18-2011 02:16 AM
Custom Composite Column silentguy Calibre 4 11-24-2010 10:28 AM


All times are GMT -4. The time now is 02:25 PM.


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