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 09-19-2013, 03:08 PM   #1
Riva3000
Calibre fan
Riva3000 began at the beginning.
 
Riva3000's Avatar
 
Posts: 30
Karma: 10
Join Date: Jul 2011
Location: Europe
Device: iRex 800SG, iPhone 3GS (shelved: iRex iLiad, KindleDX, Adam tablet)
Question A way to have column w Fixed set o values but not alphabeticaly sorted ?

I am looking for something like Enum type in most programming languages.

Right now there is 'fixed set of values' column type, but it is sorted alphabeticaly based on the text values.

What am I aiming for:
You may have a set of values like: Great, Good, Bad, Worst
Though with 'fixed set of values' column type, that is afaik always sorted alphabeticaly, that will be sorted: Bad, Good, Great, Worst
Obviously not right.

Any way to make this work in Calibre ?
Thanks
Riva3000 is offline   Reply With Quote
Old 09-19-2013, 04:28 PM   #2
BetterRed
null operator (he/him)
BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.
 
Posts: 20,570
Karma: 26954694
Join Date: Mar 2012
Location: Sydney Australia
Device: none
Prefix with '10', '20'... then you'll have gaps for inserting intermediate values
BetterRed is offline   Reply With Quote
Old 09-19-2013, 05:33 PM   #3
Riva3000
Calibre fan
Riva3000 began at the beginning.
 
Riva3000's Avatar
 
Posts: 30
Karma: 10
Join Date: Jul 2011
Location: Europe
Device: iRex 800SG, iPhone 3GS (shelved: iRex iLiad, KindleDX, Adam tablet)
BetterRed - sorry not sure what you mean. Can you elaborate a bit ?
Riva3000 is offline   Reply With Quote
Old 09-19-2013, 05:47 PM   #4
BetterRed
null operator (he/him)
BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.
 
Posts: 20,570
Karma: 26954694
Join Date: Mar 2012
Location: Sydney Australia
Device: none
Quote:
Originally Posted by Riva3000 View Post
BetterRed - sorry not sure what you mean. Can you elaborate a bit ?
@Riva3000 - see attachment, I find I don't even see the digits after a while.

And you can add '15 Very Good

BR
Attached Thumbnails
Click image for larger version

Name:	Capture.JPG
Views:	302
Size:	36.2 KB
ID:	111577  

Last edited by BetterRed; 09-19-2013 at 05:52 PM.
BetterRed is offline   Reply With Quote
Old 09-19-2013, 05:51 PM   #5
Riva3000
Calibre fan
Riva3000 began at the beginning.
 
Riva3000's Avatar
 
Posts: 30
Karma: 10
Join Date: Jul 2011
Location: Europe
Device: iRex 800SG, iPhone 3GS (shelved: iRex iLiad, KindleDX, Adam tablet)
Ah sure. Thanks for a tip !
Im affraid thats not very elegant solution tough. The numbers will show in the column and everywhere else as well (right ?)

Is there any better way to do it ? A 'proper' way to do it ?

Thinking of it maybe the numbers can be removed using column display style(s) ?
Or maybe a numerical column and then swap the numbers for titles with display style(s) ?
Not sure how the styles work though. Just remember seeing a part in Cal manual about it. :\

Last edited by Riva3000; 09-19-2013 at 05:53 PM.
Riva3000 is offline   Reply With Quote
Old 09-19-2013, 06:00 PM   #6
BetterRed
null operator (he/him)
BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.
 
Posts: 20,570
Karma: 26954694
Join Date: Mar 2012
Location: Sydney Australia
Device: none
Quote:
Originally Posted by Riva3000 View Post
Ah sure. Thanks for a tip !
Im affraid thats not very elegant solution tough. The numbers will show in the column and everywhere else as well (right ?)

Is there any better way to do it ? A 'proper' way to do it ?
If I knew of a better or proper way then I would have told you about it - but that doesn't mean that there isn't a better or proper way. But I find that method good enough - after a short while my brain learns to ignore the numbers

In the spreadsheet you could set up icons for each value using the Look and Feel->Column Icons Feature.

If you want a perfect solution you may have to raise an Enhancement Request here

BR
BetterRed is offline   Reply With Quote
Old 09-19-2013, 06:05 PM   #7
Riva3000
Calibre fan
Riva3000 began at the beginning.
 
Riva3000's Avatar
 
Posts: 30
Karma: 10
Join Date: Jul 2011
Location: Europe
Device: iRex 800SG, iPhone 3GS (shelved: iRex iLiad, KindleDX, Adam tablet)
I know I know BetterRed. Thanks for the tip!

..or I might copy and edit Calibre code for the Fixed set column.
Will Kovid kill me ?!
Riva3000 is offline   Reply With Quote
Old 09-20-2013, 03:17 AM   #8
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: 11,741
Karma: 6997045
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by Riva3000 View Post
I know I know BetterRed. Thanks for the tip!

..or I might copy and edit Calibre code for the Fixed set column.
Will Kovid kill me ?!
It won't be easy to have happiness.

You must be talking about sorting the column, not sorting the values in the edit combobox, because the order of the values in the box is the same as in the column declaration. Thus, for you to be happy you would need to change calibre's column sort, detecting (somehow) that this particular text column is to be sorted by something other than text. This is possible to do, but not trivial. You would need to generate a sort value ("key" in calibre) that is related to the order in the column declaration. And you would need to do this in a way that preserves performance.

Another option that is more elegant but quite different: use an integer column and column icons. The integer would map to your categories. The icon would give you a human-understandable visual representation. You could go so far as to add icons for the letters of the alphabet and use the multiple-icon feature in today's calibre release (1.4) to spell out what you want it to say. Of course, this works only on calibre's spreadsheet. It wouldn't show the icons in book details or elsewhere.

EDIT: The letters idea won't work with basic rules because you cannot specify the order of the icons. It would work if you used an advanced template, because there you are in charge of their order.

A third option: use an integer column, then add a column built from other columns to display the correct text. This has the advantage that the text will be visible in book details, etc. It has the disadvantage of requiring two columns.

Last edited by chaley; 09-20-2013 at 03:39 AM.
chaley is offline   Reply With Quote
Old 09-20-2013, 12:52 PM   #9
Riva3000
Calibre fan
Riva3000 began at the beginning.
 
Riva3000's Avatar
 
Posts: 30
Karma: 10
Join Date: Jul 2011
Location: Europe
Device: iRex 800SG, iPhone 3GS (shelved: iRex iLiad, KindleDX, Adam tablet)
Quote:
Originally Posted by chaley View Post
It won't be easy to have happiness.
Never is, but its my favorite hobby to seek perfection

Quote:
You must be talking about sorting the column
Yep

Quote:
because the order of the values in the box is the same as in the column declaration.
Right

Quote:
Thus, for you to be happy you would need to change calibre's column sort, detecting (somehow) that this particular text column is to be sorted by something other than text. This is possible to do, but not trivial. You would need to generate a sort value ("key" in calibre) that is related to the order in the column declaration.
Its a "key" everywhere else I think. (SQL, C#, ..)

Quote:
And you would need to do this in a way that preserves performance.
Well sorting (by) integers is always fastest afaik. Definitely faster then sorting strings, right

Quote:
Another option that is more elegant but quite different: use an integer column and column icons. The integer would map to your categories. The icon would give you a human-understandable visual representation. You could go so far as to add icons for the letters of the alphabet and use the multiple-icon feature in today's calibre release (1.4) to spell out what you want it to say. Of course, this works only on calibre's spreadsheet. It wouldn't show the icons in book details or elsewhere.
A nice hack
I thought about that as well, but at the end seemd too hacky. Plus the problems you came at.

Quote:
A third option: use an integer column, then add a column built from other columns to display the correct text. This has the advantage that the text will be visible in book details, etc. It has the disadvantage of requiring two columns.
Tryed that as well. The major disadvantages I found are
1. you cannot directly edit the composite column. You always have to go to the 'source' column to change values. I'm already using that system. Quite annoying.
2. When changing values (in source column) you have to choose from nondescript numbers, instead of values you want.

Maybe you can do what BetterRed wrote - prefixing the strings with int. Then make a composite column that will lose the prefix. Not sure if it'll retain the sorting thought. Gt test.

At the end though, it might be easier to just add to Calibre's code

Anyway thanks for all the ideas !! I'll keep trying.

Last edited by Riva3000; 09-20-2013 at 12:56 PM.
Riva3000 is offline   Reply With Quote
Old 09-21-2013, 06:03 PM   #10
calvin-c
Guru
calvin-c ought to be getting tired of karma fortunes by now.calvin-c ought to be getting tired of karma fortunes by now.calvin-c ought to be getting tired of karma fortunes by now.calvin-c ought to be getting tired of karma fortunes by now.calvin-c ought to be getting tired of karma fortunes by now.calvin-c ought to be getting tired of karma fortunes by now.calvin-c ought to be getting tired of karma fortunes by now.calvin-c ought to be getting tired of karma fortunes by now.calvin-c ought to be getting tired of karma fortunes by now.calvin-c ought to be getting tired of karma fortunes by now.calvin-c ought to be getting tired of karma fortunes by now.
 
Posts: 787
Karma: 1575310
Join Date: Jul 2009
Device: Moon+ Pro
Have you considered a 'reverse' procedure? Set your descriptive column according to your list but have a numeric column set via formula. Then sort by the numeric column. That would put your descriptive column into the desired order but still let you change that descriptive field.
calvin-c is offline   Reply With Quote
Reply

Tags
calibre, column settings, columns, enum


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Default Value for Custom Column (fixed set of permitted values) Andy P Calibre 1 06-21-2013 03:25 AM
Custom Column with list of permitted values Eugenie Library Management 1 01-10-2012 03:57 AM
Boolean custom column values sengian Library Management 4 01-05-2012 05:39 PM
Multiple comma separated values in custom column? silentguy Library Management 8 04-19-2011 05:10 AM
displaying multiple values in the same column beneath each other Firedancer885 Calibre 2 11-27-2010 03:13 PM


All times are GMT -4. The time now is 01:37 AM.


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