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-10-2011, 10:56 AM   #1
Noughty
Addict
Noughty is cognizant of many things which escape those who dream only by night.Noughty is cognizant of many things which escape those who dream only by night.Noughty is cognizant of many things which escape those who dream only by night.Noughty is cognizant of many things which escape those who dream only by night.Noughty is cognizant of many things which escape those who dream only by night.Noughty is cognizant of many things which escape those who dream only by night.Noughty is cognizant of many things which escape those who dream only by night.Noughty is cognizant of many things which escape those who dream only by night.Noughty is cognizant of many things which escape those who dream only by night.Noughty is cognizant of many things which escape those who dream only by night.Noughty is cognizant of many things which escape those who dream only by night.
 
Posts: 352
Karma: 103850
Join Date: Apr 2011
Device: Kindle NT
Custom columns question

At the moment I have two main tags like columns (tags and shelves from goodreads). I created another column - genres. I populate it with syncing with goodreads sync plug in.

What I want is to populate it from other columns too. Is it possible?

I probably wouldn't be able to sync to custom column made from other columns or could I?


Actually I just thought of a way. Don't know if it would work. I could sync to shelves column. And I could create a custom column for genres which would be from tags and shelves.

Now the problem.
The problem is that I want it to take only specific values like - historical, sci-fi, fantasy, contemporary and not take other tags like short etc. I want to extract only genres. Is it possible to make it add only those values which are determined before.
Would it be possible to add new values later?

I want to group all my tags - book length, genres, character etc. into columns. So instead of 150 tags I would have organized structure.

Basically forget the syncing part. Just how to make a custom column from two columns which would extract only specific values?

I'd appreciate any help. Hope it is possible.

Last edited by Noughty; 10-10-2011 at 11:22 AM.
Noughty is offline   Reply With Quote
Old 10-10-2011, 12:32 PM   #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,813
Karma: 1216136
Join Date: Jan 2010
Location: France
Device: Many android devices
Quote:
Originally Posted by Noughty View Post
Just how to make a custom column from two columns which would extract only specific values?
Yes, it is possible. It isn't particularly easy.

One way to have the columns dynamically correct (reflect the values currently in the other two columns) is to use a composite column (a column built from other columns). These columns use the template language to construct the value. For example, the template
Code:
{#column1}, {#column2}
will construct a column from the values in the two custom columns #column1 and #column2. Unfortunately, that isn't what you want.

It is possible to extract values from columns. The problem is knowing what values to extract. If what you want to extract is a fixed set of values, then you probably can use something like:
Code:
program:
	list_union(
		list_intersection(field('#textmult'), 'val1, val2', ','), 
		list_intersection(field('#textmult'), 'val3, val4', ','), 
		',')
If you don't have a set of fixed known values, then things get much more complicated. You would need some way to identify a value, and you would probably need a custom template function to prune the list to the correct set of values.
chaley is offline   Reply With Quote
 
Advertisement
Old 10-10-2011, 12:42 PM   #3
Noughty
Addict
Noughty is cognizant of many things which escape those who dream only by night.Noughty is cognizant of many things which escape those who dream only by night.Noughty is cognizant of many things which escape those who dream only by night.Noughty is cognizant of many things which escape those who dream only by night.Noughty is cognizant of many things which escape those who dream only by night.Noughty is cognizant of many things which escape those who dream only by night.Noughty is cognizant of many things which escape those who dream only by night.Noughty is cognizant of many things which escape those who dream only by night.Noughty is cognizant of many things which escape those who dream only by night.Noughty is cognizant of many things which escape those who dream only by night.Noughty is cognizant of many things which escape those who dream only by night.
 
Posts: 352
Karma: 103850
Join Date: Apr 2011
Device: Kindle NT
I have fixed values. I might only need to add new ones once in awhile. It's possible to add additional ones?

#textmulti is a function? No need to change that?

So I have to fill in values and columns (tags, #shelf).
val1, val2 - I should write - historical, fantasy etc?
Where should I write the columns: tags and #shelf ?
I should copy program into template?

For such a noob I might gave a perfect library soon

Thanks a lot for your help

Last edited by Noughty; 10-10-2011 at 12:44 PM.
Noughty is offline   Reply With Quote
Old 10-10-2011, 01:00 PM   #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,813
Karma: 1216136
Join Date: Jan 2010
Location: France
Device: Many android devices
Quote:
Originally Posted by Noughty View Post
I have fixed values. I might only need to add new ones once in awhile. It's possible to add additional ones?
The strings 'val1, val2' etc are the list of values you want to consider. You can change these easily by editing the template. The easiest way to edit a template is to click anywhere in the composite column and press F2, which opens the template editor
Quote:
#textmulti is a function? No need to change that?
That is the lookup name of one of your columns. You would put a different lookup name in each list_intersection call. I used #testmult because that was a tags-like column i had available.
Quote:
So I have to fill in values and columns (tags, #shelf).
Yes
Quote:
val1, val2 - I should write - historical, fantasy etc?
I assumed that the two columns contain different values and would therefore have a different list of valid values. One of the strings could be the list of valid genres, and it would in the list_intersection call with the #genres field. The other could be shelf names, and would be associated with the #shelves variable. If you have a third one, then the program would need to be extended. Exactly how will depend on what you are trying to do and the characteristics of your data -- how contents overlap (if at all) and what is supposed to happen when the same values are found in more than one column.
Quote:
Where should I write the columns: tags and #shelf ?
In the field function inside the list_intersection function.
Quote:
I should copy program into template?
Or write the one that does what you want.

I suggest that you read the documentation for the functions I used (docs are at http://manual.calibre-ebook.com/template_ref.html). That might help you understand what the template program is doing.
chaley is offline   Reply With Quote
Old 10-10-2011, 02:12 PM   #5
Noughty
Addict
Noughty is cognizant of many things which escape those who dream only by night.Noughty is cognizant of many things which escape those who dream only by night.Noughty is cognizant of many things which escape those who dream only by night.Noughty is cognizant of many things which escape those who dream only by night.Noughty is cognizant of many things which escape those who dream only by night.Noughty is cognizant of many things which escape those who dream only by night.Noughty is cognizant of many things which escape those who dream only by night.Noughty is cognizant of many things which escape those who dream only by night.Noughty is cognizant of many things which escape those who dream only by night.Noughty is cognizant of many things which escape those who dream only by night.Noughty is cognizant of many things which escape those who dream only by night.
 
Posts: 352
Karma: 103850
Join Date: Apr 2011
Device: Kindle NT
trying, tell me if something is wrong.

program:
list_union(
list_intersection(field('tags'), 'Historical, Fantasy, Sci-Fi, Contemporary, Military', ','),
list_intersection(field('#shelf'), 'Historical, Fantasy, Sci-Fi, Military', ','),
',')

This gives me result of only one genre. How to have multiple values in results? A book might be in military and historical. And the result should be Military, Historical, not just Military

I read about list functions but can't really figure it out .
Noughty is offline   Reply With Quote
Old 10-10-2011, 02:20 PM   #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,813
Karma: 1216136
Join Date: Jan 2010
Location: France
Device: Many android devices
I can't say what is wrong. That program does allow multiple results, and works for me.

One things to look at: you must match the entire genre, not part of it. For example, Military.History will not be matched by Military. You must add all of the subgenres. Yes, this is a pain. I am considering adding a list_re function that will return a sublist of items in a list that match the pattern. I need to think about how this might be used.

If the above does not point you in the right direction, please post the contents of 'tags' and '#shelf' for a book that doesn't produce the correct values.
chaley is offline   Reply With Quote
Old 10-10-2011, 02:29 PM   #7
Noughty
Addict
Noughty is cognizant of many things which escape those who dream only by night.Noughty is cognizant of many things which escape those who dream only by night.Noughty is cognizant of many things which escape those who dream only by night.Noughty is cognizant of many things which escape those who dream only by night.Noughty is cognizant of many things which escape those who dream only by night.Noughty is cognizant of many things which escape those who dream only by night.Noughty is cognizant of many things which escape those who dream only by night.Noughty is cognizant of many things which escape those who dream only by night.Noughty is cognizant of many things which escape those who dream only by night.Noughty is cognizant of many things which escape those who dream only by night.Noughty is cognizant of many things which escape those who dream only by night.
 
Posts: 352
Karma: 103850
Join Date: Apr 2011
Device: Kindle NT
Looks like it's working. Thank you so much

Last edited by Noughty; 10-10-2011 at 02:33 PM.
Noughty is offline   Reply With Quote
Old 10-11-2011, 07:21 AM   #8
Noughty
Addict
Noughty is cognizant of many things which escape those who dream only by night.Noughty is cognizant of many things which escape those who dream only by night.Noughty is cognizant of many things which escape those who dream only by night.Noughty is cognizant of many things which escape those who dream only by night.Noughty is cognizant of many things which escape those who dream only by night.Noughty is cognizant of many things which escape those who dream only by night.Noughty is cognizant of many things which escape those who dream only by night.Noughty is cognizant of many things which escape those who dream only by night.Noughty is cognizant of many things which escape those who dream only by night.Noughty is cognizant of many things which escape those who dream only by night.Noughty is cognizant of many things which escape those who dream only by night.
 
Posts: 352
Karma: 103850
Join Date: Apr 2011
Device: Kindle NT
I wanted to ask if it is possible to transform values when I am extracting them.
For example I am making column for favorites. I have values like "Favorite series", "Favorite titles". In the new column I'd like to have just word "series", "titles" etc. Since column name is already favorites. I have similar situation with a couple more columns.
Noughty is offline   Reply With Quote
Old 10-11-2011, 09:18 AM   #9
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,813
Karma: 1216136
Join Date: Jan 2010
Location: France
Device: Many android devices
Quote:
Originally Posted by Noughty View Post
I wanted to ask if it is possible to transform values when I am extracting them.
For example I am making column for favorites. I have values like "Favorite series", "Favorite titles". In the new column I'd like to have just word "series", "titles" etc. Since column name is already favorites. I have similar situation with a couple more columns.
You can do this, but it certainly adds complexity.

The following program will remove the word "favorite " from every element in the list:
Code:
program:
    list_union(
        re(list_intersection(field('tags'), 'Historical, Fantasy, Sci-Fi, Contemporary, Military', ','), 'favorite ', ''),
        re(list_intersection(field('#shelf'), 'Historical, Fantasy, Sci-Fi, Military', ','),  'favorite ', ''),
    ',')
although this example is silly because the word "favorite" does not appear in any of the lists.

You are rapidly approaching the point where you are pushing the template language beyond its limits, both in expression power and performance. A custom template function could be written that does exactly what you want and has excellent performance, but my guess is that this isn't something you are prepared to do. The other possibility is to use the 'correct' name in the original column.
chaley is offline   Reply With Quote
Old 10-11-2011, 09:46 AM   #10
Noughty
Addict
Noughty is cognizant of many things which escape those who dream only by night.Noughty is cognizant of many things which escape those who dream only by night.Noughty is cognizant of many things which escape those who dream only by night.Noughty is cognizant of many things which escape those who dream only by night.Noughty is cognizant of many things which escape those who dream only by night.Noughty is cognizant of many things which escape those who dream only by night.Noughty is cognizant of many things which escape those who dream only by night.Noughty is cognizant of many things which escape those who dream only by night.Noughty is cognizant of many things which escape those who dream only by night.Noughty is cognizant of many things which escape those who dream only by night.Noughty is cognizant of many things which escape those who dream only by night.
 
Posts: 352
Karma: 103850
Join Date: Apr 2011
Device: Kindle NT
Thanks for the reply. I think that is the most complicated I will ever push

I even managed to edit all those functions to fit if I am extracting only from one column too. So my tags, shelves grouping now is reality instead of a dream
Noughty 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
Been away for a few releases...question about custom columns support texasnightowl Calibre 3 10-14-2010 10:48 AM


All times are GMT -4. The time now is 06:34 PM.


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