Register Guidelines E-Books Search Today's Posts Mark Forums Read

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

Notices

Reply
 
Thread Tools Search this Thread
Old 10-14-2011, 08:25 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: 150
Karma: 3100
Join Date: Sep 2011
Device: Acer Iconia 500w Tablet, PRS-T1
Question View custom hierachical columns

I am rather new to calibre, but I think it will give me the flexibility I have been looking for. As I am new, I am still trying to figure out what will work the best for me.

I have been using hierachical custom columns, but I do not like how it shows the entire hierarchy in the columns view. Is it possible to have the columns view only show the last tag in the hierarchary?

For example, say I have a story in the category fantasy.magic.dragons for a fantasy story with magic where the main characters are dragons (I am not using these tags, but it gets my idea across). When I look at the columns, I only want to see the last item, dragons.

I have a lot of stories that fit into many hierachy tags like this. When I look at the columns, I can only see the beginning of the tags (ex: fantasy.magic). I will be using this on a 10.1 inch tablet, I have limited amount of space to see everything, so I cannot just extend the column to see it all.

I had thought about creating one big custom column that would have all the different ways I sort my stories and then use a composite column to take out the relevant tags. For example, I would have columns that would have a category which would have fantasy, a category which would have magic, and a category which would have dragons. But from what I read, that doesn't seem to be what composite columns are for. I don't really understand composite columns and will probably keep reading the forums until I do.

Instead I am hoping there is a way to change what shows in the columns.

- Jade Aislin
Jade Aislin is offline   Reply With Quote
Old 10-15-2011, 04:14 AM   #2
chaley
"chaley", not "charley"
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: 5,898
Karma: 1216548
Join Date: Jan 2010
Location: France
Device: Many android devices
Quote:
Originally Posted by Jade Aislin View Post
I have been using hierachical custom columns, but I do not like how it shows the entire hierarchy in the columns view. Is it possible to have the columns view only show the last tag in the hierarchary?
No
Quote:
I had thought about creating one big custom column that would have all the different ways I sort my stories and then use a composite column to take out the relevant tags.
You can use a composite column to display only the last component of each item (tag, genre, whatever). Assuming that the lookup name for the column containing the hierarchical items is #genre, then the template is
Code:
{#genre:subitems(-1,0)}
chaley is offline   Reply With Quote
Old 10-15-2011, 05:48 AM   #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: 150
Karma: 3100
Join Date: Sep 2011
Device: Acer Iconia 500w Tablet, PRS-T1
Smile composite questions

Quote:
You can use a composite column to display only the last component of each item (tag, genre, whatever). Assuming that the lookup name for the column containing the hierarchical items is #genre, then the template is

Code:
{#genre:subitems(-1,0)}
Thanks, that helped a lot. My column is Category, but that was easily substituted. It also led to a few more questions on composite columns.

1) Is there a thread or link that I can go to learn more about composite columns and how to fiddle with the template? When I looked at different threads on composite columns before they never seemed to address what I wanted. I used the code you gave me, but I am unsure how to create them on my own.

2) Is it possible to have the template only look for certain stories to display based off a higher heirarchy item? For example, (using the example I gave before fantasy.magic.dragons and fantasy.non-magic.dragons) could I create a composite column that would only display the last item of those tags that were under the magic item?

3) Is it possible to create a composite column that would only display a higher up heirarchal item? For example, could it show the second heirarchy item such as magic and non-magic only?

- Jade Aislin
Jade Aislin is offline   Reply With Quote
Old 10-15-2011, 06:56 AM   #4
chaley
"chaley", not "charley"
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: 5,898
Karma: 1216548
Join Date: Jan 2010
Location: France
Device: Many android devices
Quote:
Originally Posted by Jade Aislin View Post
1) Is there a thread or link that I can go to learn more about composite columns and how to fiddle with the template? When I looked at different threads on composite columns before they never seemed to address what I wanted. I used the code you gave me, but I am unsure how to create them on my own.
I will use genre instead of Category, because that is what I have to test with.

Two suggestions:
1) the template language manual: http://manual.calibre-ebook.com/template_lang.html. Also see the template function reference manual: http://manual.calibre-ebook.com/template_ref.html
2) the techniques post at the top of this forum: http://www.mobileread.com/forums/sho...d.php?t=118563

What might not be obvious to you is that a composite column is a column that displays the result of evaluating a template. Thus any posts that describe templates are of use when considering composite columns.
Quote:
2) Is it possible to have the template only look for certain stories to display based off a higher heirarchy item? For example, (using the example I gave before fantasy.magic.dragons and fantasy.non-magic.dragons) could I create a composite column that would only display the last item of those tags that were under the magic item?
Starting to get complicated, but yes. For example, the following template finds all genres that begin with comics or history, then extracts the last item in each genre.
Code:
{#genre:'subitems(list_re($, ',', '^(comics|history)\.', ''), -1, 0)'}
To break the template apart, first note that it is using template program mode instead of single function mode (see the manual), which is required because we want one function to use the result of another function. The list_re reduces the list of genres to those that start with what is in the regular expression pattern (comics or history) and returns that list to the subitems function. Subitems then extracts the last item from each genre in that returned list.

Note that this template works with calibre 0.8.22 (the latest release) and later.
Quote:
3) Is it possible to create a composite column that would only display a higher up heirarchal item? For example, could it show the second heirarchy item such as magic and non-magic only?
I am not sure of the details of what you are asking for. If you want the second item for all genres, then use
Code:
{#genre:subitems(1,2)}
If you want to filter first by the first item in the hierarchy, then you would use something like the template above, changing the subitems() call as necessary.
chaley is offline   Reply With Quote
Old 10-15-2011, 10:15 PM   #5
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: 150
Karma: 3100
Join Date: Sep 2011
Device: Acer Iconia 500w Tablet, PRS-T1
Smile

Quote:
Originally Posted by chaley View Post
Two suggestions:
1) the template language manual: http://manual.calibre-ebook.com/template_lang.html. Also see the template function reference manual: http://manual.calibre-ebook.com/template_ref.html
2) the techniques post at the top of this forum: http://www.mobileread.com/forums/sho...d.php?t=118563
I have skimmed over those sections before, but with the examples you gave, I think I am understanding it a little better. I'll look at them again.


Quote:
Originally Posted by chaley View Post
What might not be obvious to you is that a composite column is a column that displays the result of evaluating a template. Thus any posts that describe templates are of use when considering composite columns.
You are right, for some reason, it was not obvious to me. Now I know.

Quote:
Originally Posted by chaley View Post
Starting to get complicated, but yes. For example, the following template finds all genres that begin with comics or history, then extracts the last item in each genre.

Code:
{#genre:'subitems(list_re($, ',', '^(comics|history)\.', ''), -1, 0)'}
To break the template apart, first note that it is using template program mode instead of single function mode (see the manual), which is required because we want one function to use the result of another function. The list_re reduces the list of genres to those that start with what is in the regular expression pattern (comics or history) and returns that list to the subitems function. Subitems then extracts the last item from each genre in that returned list.
That is almost exactly what I want. However, I want it to be more general. When I tried it, I found that I had to put in the subitem path. Using your 'comics' as an example, if I had a subitem book.comics and I wanted to get the last item for any genre that contained comics I had to write out book.comics. My problem is that I also want to be able to get the last subitems of newspaper.comics. I want to be able to get the last item from each genre no matter what the higher up subitems are (book or newspaper).

I hope that made sense. I will go over the links you sent me to see if I can figure it out.

Quote:
Originally Posted by chaley View Post
I am not sure of the details of what you are asking for. If you want the second item for all genres, then use
Code:
{#genre:subitems(1,2)}
If you want to filter first by the first item in the hierarchy, then you would use something like the template above, changing the subitems() call as necessary.
This is exactly what I was asking about. Although, I wanted to grab the subitems in the third row, but this code worked.

Code:
 
{#maincategory:subitems(2,3)}
Thanks for all the help. Now I can get busy on organizing all my stories.

- Jade Aislin
Jade Aislin is offline   Reply With Quote
Old 10-16-2011, 04:21 AM   #6
chaley
"chaley", not "charley"
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: 5,898
Karma: 1216548
Join Date: Jan 2010
Location: France
Device: Many android devices
Quote:
Originally Posted by Jade Aislin View Post
That is almost exactly what I want. However, I want it to be more general. When I tried it, I found that I had to put in the subitem path. Using your 'comics' as an example, if I had a subitem book.comics and I wanted to get the last item for any genre that contained comics I had to write out book.comics. My problem is that I also want to be able to get the last subitems of newspaper.comics. I want to be able to get the last item from each genre no matter what the higher up subitems are (book or newspaper).
To repeat, you want to match some genre names no matter where they appear in the hierarchy, beginning, middle, or end. For those that match, print the last item in the hierarchy, which might be the matched item. The following does that for comics and history.
Code:
{#genre:'subitems(list_re($, ',', '(\.|^)(comics|history)\.', ''), -1, 0)'||}
The change was to not anchor (in the regular expression sense) the match to the first item, which is what I thought you wanted. Instead, the new regexp matches 'comics' or 'history' between dots (an internal item), between the beginning and a dot (the first item), between a dot and the end (the last item), or between the beginning and the end (the only item).

The reason to add the || at the end is to keep the template parser from being confused by the | characters in the regular expression.
chaley is offline   Reply With Quote
Old 10-17-2011, 01:57 AM   #7
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: 150
Karma: 3100
Join Date: Sep 2011
Device: Acer Iconia 500w Tablet, PRS-T1
Talking

Quote:
Originally Posted by chaley View Post
To repeat, you want to match some genre names no matter where they appear in the hierarchy, beginning, middle, or end. For those that match, print the last item in the hierarchy, which might be the matched item. The following does that for comics and history.
Code:
{#genre:'subitems(list_re($, ',', '(\.|^)(comics|history)\.', ''), -1, 0)'||}
The change was to not anchor (in the regular expression sense) the match to the first item, which is what I thought you wanted. Instead, the new regexp matches 'comics' or 'history' between dots (an internal item), between the beginning and a dot (the first item), between a dot and the end (the last item), or between the beginning and the end (the only item).

The reason to add the || at the end is to keep the template parser from being confused by the | characters in the regular expression.
That is exactly what I wanted. I plugged in my own items and it worked beautifully. Thank you.

Now all I need to do is input the information into the custom column. With too many stories to count, it may take some time. At least I can look forward to having a library where I can find a story I'm in the mood for.

- Jade Aislin
Jade Aislin is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Default value for custom columns? rogue_librarian Library Management 5 08-08-2011 06:43 PM
Custom Columns - How are you using yours? nynaevelan Library Management 19 04-18-2011 01:42 AM
Custom Columns Question Greg Waddell Calibre 5 03-31-2011 01:34 AM
0.7.46 and custom columns meme Library Management 4 02-21-2011 05:21 AM
Managing Custom Columns ddjohn Library Management 3 02-19-2011 11:42 AM


All times are GMT -4. The time now is 04:28 PM.


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