Welcome! Log In Create A New Profile

Advanced

HBuildKey error

Posted by John Marrone 
John Marrone
HBuildKey error
September 23, 2008 01:28PM
Hi All
I have a problem. I have created 6 tables. 2 of them have composite keys. 1 table is called workouts. When I run the program I get the error ->HBuildKey function called. No <20080212> item found in Entries file. Error code 70202. I am adding data to the workouts table. I am building the key ->dateHrsName = HBuildKeyValue(Wokouts.date_of_workouthorse,rd[index, 101 + i] ,rd[index,45]). What has this got to do with the entries table. The entries table is not even linked to the workouts table. I am in the local procedure ImportWorkoutsData. I just got threw importing data into the entries table before I called this procedure?? Am I not in the right work area And I don't think WD has work areas but I am really reaching on this one.


Here is my could. It errors out at the HBuildKey line.

PROCEDURE ImportWorkoutsData(index is int)
LOCAL
i is a int
dateHrsName is a string

IF rd[index,5] = "S" THEN RETURN

FOR i = 1 TO 10
IF rd[index, 101 + i] = "" THEN
RETURN
END
dateHrsName = HBuildKeyValue(Wokouts.date_of_workouthorse,rd[index, 101 + i] ,rd[index,45]) <- error

HReadSeekFirst(Wokouts,date_of_workouthorse,dateHrsName)

IF NOT HFound(Wokouts) THEN
Wokouts.date_of_workout = rd[index, 101 + i]
Wokouts.horse = rd[index,45]
END

Wokouts.display_date = GetDisplayDate(rd[index,101 + i])
Wokouts.time_of_workout = rd[index, 113 + i]
Wokouts.display_time = GetDisplayTime(rd[index, 113 + i])
Wokouts.track = rd[index, 125 + i]
Wokouts.distance = Val(rd[index, 137 + i]) / 220
Wokouts.track_condition = rd[index, 149 + i]
Wokouts.description = rd[index, 161 + i]
Wokouts.main_track = rd[index, 173 + i]
Wokouts.number_for_day = rd[index, 185 + i]
Wokouts.ranking_for_day = rd[index, 197 + i]

IF NOT HFound(Wokouts) THEN
HAdd(Wokouts)
ELSE
HModify(Wokouts)
END

rd[index, 101 + i] holds "20080212" a string data.
rd[index,45] holds a horses name "Go Daddy Go"

I am putting data into the workouts table and yet I get the error -> HBuildKey function called. No <20080212> item found in Entries file. Error code 70202. Hope somebody can help me here. I can not figure this out.
END

John Marrone
Re: HBuildKey error
September 23, 2008 02:10PM
Hi All
I have got it working by switching to this code and not using HBuildkey.

HReadSeekFirst(Wokouts, date_of_workouthorse,[rd[index, 101 + i], rd[index,45]])

This way you do not have to build a composite key. I still don't understand why it would not work right the other way. I looked in help under HBuildKey and the help recommended to use this method as it is quicker.

Thought others might want to know this.

Thanks for you time and effort.
Joris
Re: HBuildKey error
September 23, 2008 02:56PM
Hi John,

I also use the second way of searching on comp keys.

I have had a quick look on your code : I think the point after your filename should be replaced by an comma.

dateHrsName = HBuildKeyValue(Wokouts.date_of_workouthorse,rd[index, 101 + i] ,rd[index,45])

must be

dateHrsName = HBuildKeyValue(Wokouts,date_of_workouthorse,rd[index, 101 + i] ,rd[index,45])


regards,

Joris.
LS
Re: HBuildKey error
September 23, 2008 03:09PM
Hello,
It actually does work but there's a typo in your code. Wokouts.date_of_workouthorse this will result in the date you mentioned.
dateHrsName = HBuildKeyValue(Wokouts.date_of_workouthorse,rd[index, 101 + i] ,rd[index,45]) <- error
the syntax is:
Result = HBuildKeyValue(File name, Composite key name, Component values)
which means in your code that
File name = Wokouts.date_of_workouthorse
Composite key name = rd[index, 101 + i]
Component values = rd[index,45]
The code should be:
dateHrsName = HBuildKeyValue(Wokouts,date_of_workouthorse,rd[index, 101 + i] ,rd[index,45])
Lennart
John Marrone
Re: HBuildKey error
September 23, 2008 03:19PM
Thanks, I work alone so I don't have an other pair of eyes to look at the code. Thanks I should of guessed that cause I know how to use the function. I knew it had to be me.
Author:

Your Email:


Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: