December 13, 200223 yr Newbies Hi everybody this is my first post so take it easy on the newb. I have a problem with creating new records through a portal. I have 4 database files: Clients, Therapists, Service, Service Logs The error I get is "The relationship "Service" is not valid and must be corrected before this field can be modified" The service database holds each service that is done with a client. The Service Log database shows the client and therapist with each service related to them in a portal. I'm able to see the related service records when I select a client and therapist. But when I try to add a new record through the portal I get that error "The relationship "Service" is not valid and must be corrected before this field can be modified" Hope thats enought information for you guru's. Thanks for any help. V
December 13, 200223 yr Check that the field you are displaying in the portal has the same relationship as the portal itself.
December 13, 200223 yr Author Newbies Thanks for the reply! Yes the portal and the fields in the portal use the same relationship that I defined. the relationship uses a caluclation of client ID and therapist ID. The calculation is the exact same in both the service database and the service log database. I double checked that as well. The thing is that it shows the related records that are already in the service database just fine. but its when I try to add new ones to the service database through the portal in the service log database that I get that problem. Thanks again for the help. Its greatly appreciated
December 13, 200223 yr Author Newbies Yes I have double checked the relationships definition and that the fields and the portal are using the same relationship definition. thanks for all the help. V
December 13, 200223 yr Your right key is calculated. The allow creation of related records can not work when the right key is calculated. Instead, use the primary relationship (ID-->ID) for creating related records or use external script for creating child record or redefine your actual relationship to have only left key calculated and leave "allow creation of related records " on Dj
December 13, 200223 yr Hi GrandMasterV, Your problem arises from the fact that you have a calculating field as the key field on the right side of your relationship. In order to create a new record via the relationship, FileMaker has to be able to write the correct key value for the current record in the main file to the corresponding key field in the related file (to establish the link). Since calculating fields cannot be written/modified, relationships which use them as the related file key are not able to create new records via the relationship. A couple of solutions are: 1. create the new records via a script which transfers the values on which the key field in the related file depends to global fields in the related file and then calls a subscript in the related file to create a new record and copy the values from the global fields to the appropriate destination fields in the new record (thus establishing the link back to the main file via the calculated key. or 2. Reverse the direction of calculation in your related file. Set the key field as a data entry (text) field, and re-define the component fields as calculations with formulae which parse the component values from the concatenated text in the key field. That way you'll be able to create new records via the relationship, but will still have access to the separate values for use in the related file.
Create an account or sign in to comment