|
Strange behavior when adding data records |
Iniciado por Volker Gericke, 06,ene. 2024 10:29 - 3 respuestas |
| |
| | | |
|
| |
Publicado el 06,enero 2024 - 10:29 |
Hello,
I am creating a photo database. The records are created automatically when the directories are read (basically a "dir /s" is performed). This works impressively fast and well.
In order to be able to run evaluations, there is a directory structure: Drive:\photography\Topic\Series\Picture.jpg
"Drive:\photography\" is defined. "Topic" can be "Cars", "Portrait", "Landscape", ... or whatever you like "Series" can be "New York 5.11.2022", for example. A typical directory could therefore be "Drive:\photography\Landscape\New York 5.11.2022\Picture0001.jpg".
The program now reads in the files and directories. sFileList is string sFile is string
sFileList = fListFile("Drive:\photography\*.jpg")FOR EACH STRING sFile OF sFileList SEPARATED BY CR Pictures.Topic = ExtractString(sFile,3,"\",FromBeginning) Pictures.Series = ExtractString(sFile,4,"\",FromBeginning) Pictures.Filename = ExtractString(sFile,5,"\",FromBeginning) Pictures.Picture = sFile IF Pictures..NewRecord THEN Pictures.Add() END Series.Topic = Pictures.Topic Sets.Series = Pictures.Series IF Series..NewRecord THEN Series.Add() END
Topic.Topic = Pictures.Topic IF Topic..NewRecord THEN Topic.Add() END END Unfortunately, the Add() commands for "Series" and "Topic" persistently generate duplicate errors.
The database "Pictures" has a unique index via the fields "Topic + Series + Filename".
The "Series" database has a unique index on the "Topic + Series" fields.
The "Topic" database has a unique index via the "Topic" field.
How do I get rid of the duplicate errors?
Regards
Volker |
| |
| |
| | | |
|
| | |
| |
Miembro registrado 31 mensajes |
|
Publicado el 08,enero 2024 - 15:39 |
I have found ..NewRecord to be unreliable. Use if not HReadSeekFirst (something,index) then HAdd(e.g. Topic) end
-- Garry |
| |
| |
| | | |
|
| | |
| |
Publicado el 08,enero 2024 - 16:58 |
Hi Garry,
I will try that. I also saw something about the unreliability of Newrecord. But that was 2018, and still newrecord is in the tutorials. Well, anyway. Thank you, I will check that out. 😊
Kind regards,
Volker |
| |
| |
| | | |
|
| | |
| |
Publicado el 20,enero 2024 - 11:43 |
Hi Garry and all,
HReadSeekFirst fires the same errors:
sGDirList is string sGDir is string sGDirList = fListDirectory("D:\Photographs\",frNotRecursive)
FOR EACH STRING sGDir OF sGDirList SEPARATED BY CR Topics.Name = ExtractString(sGDir,3,"\",FromBeginning) IF NOT HReadSeekFirst(Topics,Name,ExtractString(sGDir,3,"\",FromBeginning)) THEN HAdd(Topics) END END
It seems not to be possible to implement a "CASE ERROR:"-procedure that does nothing more than silently jumping to the next entry in the list.
Kind regards,
Volker |
| |
| |
| | | |
|
| | | | |
| | |
|