Jump to content

Relationship Problem


brzfan2
 Share

This topic is 5637 days old. Please don't post here. Open a new topic instead.

Recommended Posts

I am working on a database for donations. I have a contact table which holds each donors information. I have a donation table to hold the donations and a donation detail table. The contact ID is the key field in the relationship between contacts and donations. The line item ID is the key field in the relationship between donations and detail.

Each donors can have many donations and each donation can be spread over many accounts. What I would like to do is design a donation entry layout in the donations table. I have pulled the Contact ID, name, address in by putting the fields from the contact table in the donation layout. My problem is this, when I add a new record to post the payment it will not pull in the contact information because the contact file did not create the new record thru the relationship. Is there a way to do this based on the donation table, either thru a find or maybe a value list so the person entering the information can pick the donor and the information will show up on the layout? If I do it through the contact table then my automatic receipt ID's, date, etc will not generate in the portal.

Link to comment
Share on other sites

If you use a button in the contact layout to pass the contact id, as a parameter, to the script that then opens a new window in the donations layout, which then creates the new record and using set field, sets the contact id of the donor id using the script parameter. From here on out, you just fill in the rest of the information for the donation details, and do what you normally do.

That should do what you want, generally speaking.

Link to comment
Share on other sites

Thanks for the answer.

I have never used the parameter before. Can you give an example?

What I need to do is from the donation table, create a new record and then look up the contact from the contact table and somehow get that ID number into the new record. The contact ID is the relationship and cannot be changed.

I tried a script to go and find the contact, copy the ID and paste it in the donations new record but since it cannot be changed it would not work.

I am just not sure what to try. I suspect it would involve a global field and a new table occurance but I don't know what the relationship would be or quite how to do the global setup.

Link to comment
Share on other sites

I think you should upload the file. It sounds like there's something fishy in the way you set up the field write permissions.

The contact ID, which is the related key in the donations table should be modifiable. Go to your define database window and turn on the ability to modify that field in your donations table. The field doesn't have to appear on the layout, so it won't be user modifiable except through the script that you're using to fetch the id from the contact table.

As for script parameters, use the Filemaker Help. It isn't very descriptive, but it should give you an idea how to use them. A book like the Missing Manual wouldn't hurt either. You could teach yourself faster than if I tried to explain it.

Good luck.

(The unique IDs should be no-modify on the records on which they describe. For example, the serial number for the donations table should be no-modify, but a field in another table used to relate to the donations table does not have to be no-modify. Since most of these fields are typically not visible in a layout, they're only modifiable via a script step anyhow, and if it is visible in a layout, a quick formatting of the field behavior can disallow users from clicking into, tabbing into, and other wise attempting to modify the contents of the match fields.)

Link to comment
Share on other sites

Thanks for your help. I will check the ID setup.

I think I have found a way to do what I want thru the contact table. I have a tab setup in the contact layout with a portal to recap the donations date and amounts only. The date defaults in. I made the date field a get related record that opens the donation detail layout. This way I can find the contact, enter the amount in the portal so the date defaults in, click the date and it opens the other layout and then I can finish entering the detail. So far it seems to be working.

Link to comment
Share on other sites

That definitely works, but it isn't very specific. Until you set the contact id for the portal item, all the unset donations records will show up in the portal, and you could easily make a mistake in assigning the donation record to the correct contact record.

Consider using a button from within contacts to create the new donations records. When you specify the button, edit the parameter to be the contact id. When your script reaches the point in the script where it changes layout and creates a new record, use the Set Field script step to point to the contact id field in the donations table, and the result will be Get(ScriptParameter). Get(Script Parameter) is the built-in function for retrieving and returning the parameter you passed to the script when you clicked on the button.

That should be it. Your new donations record should be linked to the contacts record that contained the button you clicked on.

As for adding contact ids after the fact, the script you described earlier should work, and debugging it should be a priority. The portal based workaround you're using sounds inconvenient.

Link to comment
Share on other sites

This topic is 5637 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.