05-11-2022, 06:30 AM | #1 |
Junior Member
Posts: 3
Karma: 10
Join Date: Jul 2019
Location: India
Device: Calibre
|
To construct an unique column
Query:
I have e-books in my library with a few custom columns. One such custom column labeled as "Accession Number" so that to avoid duplications (i.e.) No e-book record should have the same Accession Number―An Unique Column. Now when adding a new set of e-books to the same library, but unfortunately if I specified a previous mapped Accession number to the new e-book, then it would be a tragedy! Suggest: I need to set a rule or validation message warning when I repeat the same Accession Number. This also implies to have the same structure to ISBN [Pre-Defined Column], so that no e-books have the same ISBN. Gist: Finally, to say that all records should be unique but not identical. |
05-11-2022, 07:56 AM | #2 |
creator of calibre
Posts: 43,850
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
Use the identifiers for that.
|
Advert | |
|
05-11-2022, 09:01 PM | #3 |
Custom User Title
Posts: 8,598
Karma: 61176603
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
Due to the way the database works, Calibre already has a unique ID for each book record. Just add {id} to a column-built-from-other-columns.
|
05-12-2022, 07:00 AM | #4 |
Junior Member
Posts: 3
Karma: 10
Join Date: Jul 2019
Location: India
Device: Calibre
|
To construct an unique column
I'll make it clear. I need the pre-defined column (field) or custom column (field) should be unique. If by mistake I entered the same value, then it should not save. Kindly look at the following sample library structure:
Accession No. Title ISBN AN-001 Book01 9781234567890 AN-002 Book02 9781234567891 AN-003 Book03 9781234567892 AN-003 Book04 9781234567893 AN-005 Book05 9781234567894 AN-006 Book06 9781234567895 AN-007 Book07 9781234567896 AN-008 Book08 9781234567897 AN-009 Book09 9781234567897 AN-010 Book10 9781234567899 The "AN-003" and "9781234567897" are unfortunately duplicated in Accession No. and ISBN respectively. Now my request is to get a warning message to state that the new value that is entered is already existing in the library. So software should prevent me from input duplicate data. |
05-12-2022, 12:04 PM | #5 | |
Well trained by Cats
Posts: 29,792
Karma: 54830978
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
Quote:
Find Duplicates Plugin (identifiers: ISBN or identifiers: Title. 2 passes required to find both) will locate those issues for YOU to resolve. Some of us WANT edition x-references references to exist. |
|
Advert | |
|
05-12-2022, 12:05 PM | #6 |
Wizard
Posts: 4,552
Karma: 950151
Join Date: Nov 2008
Device: Sony PRS-950, iphone/ipad (Marvin/iBooks/QuickReader)
|
What is wrong with using the existing standard column ‘id’ that is guaranteed to be unique? Not sure what is the purpose of trying to replicate its functionality.
|
05-12-2022, 12:12 PM | #7 | |
Well trained by Cats
Posts: 29,792
Karma: 54830978
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
Quote:
(I can't remember if a rename of Title or Author causes this also) I remember using -{id} at the end of my file template when I first started with my EZreader. when I shifted computers/Libraries (on device status was all ???) Just believe that {id} is not fool proof, either. |
|
05-12-2022, 01:38 PM | #8 |
Grand Sorcerer
Posts: 11,739
Karma: 6997045
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
I understand you as saying that you want the ability to specify that a single-valued column's value be unique in the database. There is nothing in base calibre that will do such a check.
It can be done in the Action Chains plugin using a chain that checks for duplicates when a book record is modified, a process that will probably be slow but has the advantage of not needing any programming. Ask in that thread if you want to try this and need help. Best would be to write a custom plugin that uses calibre's metadata_changed event and cache.get_item_id(). The plugin would check if a value (an 'item_name') is already in use and if so then show a warning. It could mark the books. I think this can only flag the change, not prevent it from being made. I also wonder what would happen if the change is being made by something like bulk metadata edit. My guess is that you would need to write the plugin, as no one who does plugins has needed/wanted this ability. |
05-12-2022, 06:31 PM | #9 | |
null operator (he/him)
Posts: 20,565
Karma: 26954694
Join Date: Mar 2012
Location: Sydney Australia
Device: none
|
Quote:
See ==>> Change Author - Version 0.9.4 Why not a File Type plugin that generates the Accession Number value by incrementing a preference setting (global or per library) when a book is added. Along with a Library Closed plugin that checks that a column is unique. BR |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Single column ePUB becomes 2 column when converted to Kindle (mobi) | rmcape | Conversion | 0 | 09-21-2013 12:52 PM |
Using "Build column from other column" custom-column type | HFC3 | Library Management | 3 | 07-07-2013 03:11 AM |
Q: multi-column PDF to single column mobi format converstion | auburn1975 | Calibre | 7 | 01-28-2012 06:11 PM |
"integrity error column book is not unique" | Atiajar | Calibre | 4 | 12-21-2010 11:22 PM |
Ideas on how to construct a dictionary | eriĉjo | ePub | 1 | 07-13-2010 04:25 AM |