Diese Seite mit anderen teilen ...

Informationen zum Thema:
WinDev Forum
Beiträge im Thema:
Erster Beitrag:
vor 2 Jahren
Letzter Beitrag:
vor 2 Jahren
Beteiligte Autoren:
Peter Hite, ICI, GuenterP, Al

HReadSeekFirst problem with composite keys and empty dates

Startbeitrag von Peter Hite am 30.06.2016 19:20

Having a heck of a time figuring this out. I have a file (requests) with a composite key consisting of a store # field (integer) and a date fulfilled field (date). The idea was to use HReadSeekFirst to find an unprocessed record by store number. But it doesn't recognize an empty date for some reason. I have a table with 2 records in it, one with a blank date and one with a current date. If I do the following:

IF HReadSeekFirst(requests,storenumDateFulfilled,[7998,""])=False
RETURN // Not found or error
IF HFound(requests) = False THEN
RETURN // Not Found
IF requests.DateFulfilled "" THEN

The HReadSeekFirst and HFound passes, but the DateFulfilled is the current date, NOT the empty date as desired. Any ideas? Is this a bug?


Hello Peter

I have never had much luck using the array method [] and I find that using HBuildkeyValue() is more reliable so you could try that instead


von Al - am 01.07.2016 02:21
Maybe you can try with this (don't use second parameter-date):

Regards !

von ICI - am 01.07.2016 06:52
Thanks for the reply, but I did try both ways.

von Peter Hite - am 01.07.2016 12:56
Thanks, I'll try your way. But I would still like to know why what I wanted to do didn't work. I may just have to change my search key to get around this problem.

von Peter Hite - am 01.07.2016 13:03
HFound() return False because hreadseekfirst() do exact search and with parameter
" " record such that can not be found. With parameter "hgeneric" you say hreadseekfirst() you try to find not exact record but closer equal and stop your search when you find first matching record with "hlimitparsing"

Regards !

von ICI - am 02.07.2016 18:42
Hi, since WD 5.5 I'm building composite keys as string keys by programming, even if parts of the key are numeric, dates etc. From v12 on I'm using triggers for that and I'm still doing so. A string as a "composite key" has the advantage that all of it can be inspected visually without pain. You can easily take care of empty dates and other funnies.

von GuenterP - am 03.07.2016 05:17
Zur Information:
MySnip.de hat keinen Einfluss auf die Inhalte der Beiträge. Bitte kontaktieren Sie den Administrator des Forums bei Problemen oder Löschforderungen über die Kontaktseite.
Falls die Kontaktaufnahme mit dem Administrator des Forums fehlschlägt, kontaktieren Sie uns bitte über die in unserem Impressum angegebenen Daten.