Relationship: First or Last Matching Record?

This forum is for application developers who are integrating HanDBase into their solutions via the HanDBase API (HAPI) or other means. It's also a great place to discuss runtime development.

Relationship: First or Last Matching Record?

Postby sababe » Fri Nov 08, 2013 9:09 am

Dear experts, I somehow do not really understand how the links and the relationship between two databases work and need your help!

This is what I would like to have:
We have a big freezer and to make the management of the frozen items easier, we mark the to-be-frozen items just by a number, instead of a label with description. However we want to maintain a comprehensive description in a database.

I built a simple freezer application containing two databases linked together in one-to-many relationship:
The one database (parent) contains unique ID numbers and should show information, whether the respective number is used or free from the data of the other database.
The other database (child) contains description oft he frozen items, identified by the „ID number“. In this database the existing items of the same kind (e.g. vanilla ice cream) are all stored and identified by one specific ID number ( e.g. Field “ID-Number” = 11, Field “Amount” = 5). When all items with the same ID number are consumed (here 5 vanilla ice cream boxes with ID number 11), the ID number becomes free for the next usage, this means the field “amount” is set to 0 and the field “consumed date” is set to current date. The consumed items (with field “amount” = 0 and field “consumed date” > 1.1.1904) have to stay in the database, because sometimes this information helps to identify “forgotten” old frozen items in practice.

Now I tried to implement these requirements as follows:
Parent database contains unique ID Numbers, a link to the child database and shows the “amount” field and the “consumed date” field in relationship from the child database.
The child database contains (in addition to other description fields) an “ID number” filed, linked to the parent database, and fields “amount” and “date consumed”.
When adding a new item to the child database it should be possible to show and select only not-used ID numbers from the parent database.
Unfortunately the parent database shows wrong values in the fields “amount” and “date consumed”, whether I chose the relationship “First matching record” or “Last matching record”.
“Wrong” values means: it shows “amount” = 0, even though there is already a new entry within the child database with the same ID and “amount” > 0.

What can I do to implement this requirement??
Any help is highly appreciated!
Posts: 3
Joined: Thu May 23, 2013 6:40 pm

Re: Relationship: First or Last Matching Record?

Postby dhaupert » Fri Nov 08, 2013 10:22 am

Hi there,

Thanks for your post. I followed most of it but wanted to clarify a little bit before trying to assist- are you doing the following in your typical operation:

opening the child database directly
adding a new record to it
tapping the linked field to show the link database.
Looking at the amount fields for items in the parent database to find one where the amount equals zero

Is that the order of operations for this database or is there a different flow in this case?
Posts: 4113
Joined: Tue May 26, 2009 11:51 am

Return to HanDBase - Developers

Who is online

Users browsing this forum: No registered users and 1 guest