Help with SCID?

Discussion of anything and everything relating to chess playing software and machines.

Moderator: Ras

JVMerlino
Posts: 1407
Joined: Wed Mar 08, 2006 10:15 pm
Location: San Francisco, California

Help with SCID?

Post by JVMerlino »

I'm trying to find all games in a large PGN file in which the game was lost on time, and then delete those games from the PGN. I'm trying to do this with SCID, but I'm not at all familiar with the program and sadly can't figure it out.

Can anybody provide assistance, either with SCID or a different program? Thank you!
User avatar
phhnguyen
Posts: 1538
Joined: Wed Apr 21, 2010 4:58 am
Location: Australia
Full name: Nguyen Hong Pham

Re: Help with SCID?

Post by phhnguyen »

Since you ask about “a different program”, I give a short help to do that task with Banksia GUI

1) Drag-drop your PGN into Banksia GUI (BSG), you should see a popup dialog as the Fig. 1

2) Check if it shows the column named “Termination”. If it is not, you may go to Settings (using the button on the right side), tab "Databases", on the the “Show Games table with columns” select "All" from the dropdown box

3) Click on the top of column “Termination”, it will be sorted Ascending. Click again, it will be sorted Descending.

Now, just scroll down the table and find the games with the right termination you want. Depending on the app, the contents may be different. BSG uses the string “timeout”, and Lichess uses “Time forfeit”. Click on any line you want to view the game. You may copy, and save it later.

Image
Fig. 1 Database viewer


4) If you want a faster way than step (3), you may query using SQL statements. When reading a PGN database, BSG has always converted it into an SQLite database. Just click on the tab “SQL Query”, copy, and paste the below statement, click the button “Run" and the right games will be displayed as Fig. 2

Code: Select all

SELECT e.Name Event, s.Name Site, w.Name White, b.Name Black, g.*
FROM Games g
INNER JOIN Events e ON EventID = e.ID
INNER JOIN Sites s ON SiteID = s.ID
INNER JOIN Players w ON WhiteID = w.ID
INNER JOIN Players b ON BlackID = b.ID
WHERE Termination LIKE '%Time%'
Image
Fig. 2 Query with an SQL statement

Have fun!
https://banksiagui.com
The most features chess GUI, based on opensource Banksia - the chess tournament manager
User avatar
phhnguyen
Posts: 1538
Joined: Wed Apr 21, 2010 4:58 am
Location: Australia
Full name: Nguyen Hong Pham

Re: Help with SCID?

Post by phhnguyen »

Sorry, I forgot your second requirement: "delete those games".

To delete with BSG, it needs some more steps:

1) Convert from your PGN file into an OCGDB database (the database format BSG supports)
In BSG, menu -> Tools -> Create Database. It will popup a dialog, just fill your PGN file and a new name for the OCGDB database

2) Run an SQL statement to delete games

Open the new OCGDB database by dropping it into BSG. In the tab "SQL Query", enter the below statement and run:

Code: Select all

DELETE FROM Games
WHERE Termination LIKE '%Time%'
All games which are lost on time should be removed. If you see some error messages such as "Games table locked", go to the tab "Games & tables" and select (to view) any other table.

3) Export from the OCGDB file into the PGN file

The function Export of current BSG (version 0.54) doesn't work (by a mistake), you may wait for us for a week to fix that bug or use the program ocgdb, download and run it as:

Code: Select all

ocgdb -export -db big.ocgdb.db3 -pgn big.pgn
You may use ocgdb and any SQLite app to complete the task too.
https://banksiagui.com
The most features chess GUI, based on opensource Banksia - the chess tournament manager
Colin-G
Posts: 191
Joined: Mon Oct 31, 2016 6:30 pm
Location: England

Re: Help with SCID?

Post by Colin-G »

JVMerlino wrote: Fri Jun 03, 2022 6:57 am I'm trying to find all games in a large PGN file in which the game was lost on time, and then delete those games from the PGN. I'm trying to do this with SCID, but I'm not at all familiar with the program and sadly can't figure it out.

Can anybody provide assistance, either with SCID or a different program? Thank you!
Scid cannot delete games from pgn files.
Create a new scid database
Copy pgn file into the new scid database
Use the search function to search for "lost on time" or similar in the "PGN contains text" box
Delete all the files it finds
Reset filter to view all files
Export the Scid file to overwrite existing pgn file or save to new pgn file.
JVMerlino
Posts: 1407
Joined: Wed Mar 08, 2006 10:15 pm
Location: San Francisco, California

Re: Help with SCID?

Post by JVMerlino »

Thanks very much!