My app records the results of numerous blood tests for an individual. Each type of test has its own table that consists of 3 fields:
A date
A time
A number
I created a set with the individual's table as the primary and each of the test result tables as the children. The individual's table record also has a date in it, and so I used that as the parent key to the date in each different child table as the child key.
It is a one-to-many link with no referential integrity since the date in the primary table has no relation to the children. Just using it as the key.
There are many results for each individual test, but what I am having a problem with is trying to display the last result of each individual test all on the same form.
I created a form using the primary table as the form table, with the children's date, time and number fields on the form.
Then I went nuts wasting time trying to fill the form.
I created a script whose intent is to fetch the last record of each child table so and display it. I have tried 4 different ways shown in the V7 docs, but cannot get any one to work. In every version I get the error:
Parent table restricted: refetching
while trying to fetch the last record. Here is a test script for just one child:
'Load Last Value of Blood Tests
dim s as P
dim child_tbl as P
'Get pointer to primary table of set
s = set.open_session("test values")
'Get pointer to the albumin table
p1 = s.albumin
p1.fetch_last()
s.close()
the p1.fetch_last() causes the error no matter how many ways I code that "fetch_last" command.
I am calling the script from the OnFetch event for the form.
Your expression of all-knowing wisdom is highly appreciated, as always... :)
A date
A time
A number
I created a set with the individual's table as the primary and each of the test result tables as the children. The individual's table record also has a date in it, and so I used that as the parent key to the date in each different child table as the child key.
It is a one-to-many link with no referential integrity since the date in the primary table has no relation to the children. Just using it as the key.
There are many results for each individual test, but what I am having a problem with is trying to display the last result of each individual test all on the same form.
I created a form using the primary table as the form table, with the children's date, time and number fields on the form.
Then I went nuts wasting time trying to fill the form.
I created a script whose intent is to fetch the last record of each child table so and display it. I have tried 4 different ways shown in the V7 docs, but cannot get any one to work. In every version I get the error:
Parent table restricted: refetching
while trying to fetch the last record. Here is a test script for just one child:
'Load Last Value of Blood Tests
dim s as P
dim child_tbl as P
'Get pointer to primary table of set
s = set.open_session("test values")
'Get pointer to the albumin table
p1 = s.albumin
p1.fetch_last()
s.close()
the p1.fetch_last() causes the error no matter how many ways I code that "fetch_last" command.
I am calling the script from the OnFetch event for the form.
Your expression of all-knowing wisdom is highly appreciated, as always... :)
Comment