Smart Collections - Character Count

Talk to other Pedia users about the programs, share tricks and tips or ask questions about existing features.
Post Reply
DanThe
Addicted to Bruji
Addicted to Bruji
Posts: 155
Joined: Tue Jan 05, 2016 6:23 pm

Smart Collections - Character Count

Post by DanThe »

A smart collection can be setup to search for blank fields which automatically enters custom8 == nil as the search value.

Is there a way to setup a smart collection to search a field containing a character count greater than a target number?

The reason I ask is that when I transferred the my old DB (via XML export) info into CDpedia, I have UPC values that are greater than 12 characters so I like to gather these in a smart collection to be able to verify and correct these values.
User avatar
Conor
Top Dog
Posts: 5335
Joined: Sat Jul 03, 2004 12:58 pm
Contact:

Re: Smart Collections - Character Count

Post by Conor »

That is a tough one. There is no built in support from the objective-c side or in the interface for a count of characters. But you could certainly use the SQLite database backend to get a list of the titles that exhibit that long UPC.

Code: Select all

sqlite3 /Users/fa/Library/Application\ Support/CDpedia/Database.cdpd
select ztitle from zentry where length(zupc) > 12;
.exit
If you have hundreds of them, the easier way might be to simply sort your entire collection on UPC column and the ones with a longer UPC will be towards the bottom and you can pick them all up for selection with shift click and use "File -> New collection from Selection". Some with zero padding at the beginning will slip through the sorting and be higher up, but you can catch the titles for those with the above SQL command, after cleaning up the others.

You could pull out the "Z_PK" for the entries with an SQL command and then insert them into a regular collection by changing the text into an SQL insert command (INSERT INTO "Z_1ENTRIES" VALUES(COLLECTION Z_PK, ENTRY Z_PK);). But that is getting really advanced and messing with the database, instead of just printing out information from it.
Post Reply