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 05-11-2022, 06:30 AM   #1
Krishnam Prabhu
Junior Member
Krishnam Prabhu began at the beginning.
 
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.
Krishnam Prabhu is offline   Reply With Quote
Old 05-11-2022, 07:56 AM   #2
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 43,850
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Use the identifiers for that.
kovidgoyal is offline   Reply With Quote
Advert
Old 05-11-2022, 09:01 PM   #3
ownedbycats
Custom User Title
ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.
 
ownedbycats's Avatar
 
Posts: 8,598
Karma: 61176603
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
Quote:
Originally Posted by Krishnam Prabhu View Post
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.
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.
ownedbycats is online now   Reply With Quote
Old 05-12-2022, 07:00 AM   #4
Krishnam Prabhu
Junior Member
Krishnam Prabhu began at the beginning.
 
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.
Krishnam Prabhu is offline   Reply With Quote
Old 05-12-2022, 12:04 PM   #5
theducks
Well trained by Cats
theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.
 
theducks's Avatar
 
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:
Originally Posted by Krishnam Prabhu View Post
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.
It is not the software's job to prevent you from making 'GIGO errors'.
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.
theducks is offline   Reply With Quote
Advert
Old 05-12-2022, 12:05 PM   #6
itimpi
Wizard
itimpi ought to be getting tired of karma fortunes by now.itimpi ought to be getting tired of karma fortunes by now.itimpi ought to be getting tired of karma fortunes by now.itimpi ought to be getting tired of karma fortunes by now.itimpi ought to be getting tired of karma fortunes by now.itimpi ought to be getting tired of karma fortunes by now.itimpi ought to be getting tired of karma fortunes by now.itimpi ought to be getting tired of karma fortunes by now.itimpi ought to be getting tired of karma fortunes by now.itimpi ought to be getting tired of karma fortunes by now.itimpi ought to be getting tired of karma fortunes by now.
 
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.
itimpi is offline   Reply With Quote
Old 05-12-2022, 12:12 PM   #7
theducks
Well trained by Cats
theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.
 
theducks's Avatar
 
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:
Originally Posted by itimpi View Post
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.
{ID} is per Library. If you copy/move a book, it gets a new ID
(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.
theducks is offline   Reply With Quote
Old 05-12-2022, 01:38 PM   #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,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.
chaley is offline   Reply With Quote
Old 05-12-2022, 06:31 PM   #9
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,565
Karma: 26954694
Join Date: Mar 2012
Location: Sydney Australia
Device: none
Quote:
Originally Posted by theducks View Post
{ID} is per Library. If you copy/move a book, it gets a new ID
(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.
↑ ↑ ↑ ✔

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
BetterRed is offline   Reply With Quote
Reply


Forum Jump

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


All times are GMT -4. The time now is 08:50 AM.


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