raymate Posted July 21, 2007 Posted July 21, 2007 (edited) Hello, Can any one tell me what I'm doing wrong or if indeed it can be done. I'm going to describe it in it's basic form but of course I have lots more field in the database I'm using, just removed all the field name to make it easy to see what I want. OK, I have tables as below with the fields in them as shown: customers: cutomer_ID customer_name customer_company bookings: booking_IDfk booking_type booking_date The "customer_ID" is a serial number created on any new record. I then have two LAYOUTS, one for CUSTOMERS and the other for BOOKINGS. What I would like to do is have a button on the CUSTOMERS layout that fires a script (I assume it would need to be a script) and moves to the BOOKINGS layout and set the "booking_IDfk" to the same serial number from the CUSTOMER record the user was in. So the booking was linked to the customer. Now we had this working fine using PORTALS on the CUSTOMERS layout, and of course each time we added data into the portal it would create the ID number on the BOOKINGS the same as the CUSTOMERS But we have lots of fields and PORTALS look a bit messy, so we wanted to create a nice presented layout for the bookings. But I cant seem to make it work. I was trying with a script to, go to BOOKINGS layout --> new record --> set booking_IDfk to customer_ID with a calc But this dont work and I cant see why, but again is this what I should do? Edited July 21, 2007 by Guest
*susan* Posted July 21, 2007 Posted July 21, 2007 you wrote: << I was trying with a script to, go to BOOKINGS layout --> new record --> set booking_IDfk to customer_ID with a calc>> Nope, this won't work. There are several ways to make your interface "slicker", as you requested. 1. have two relationships between customer and booking. One allows record creation, and one doesn't. The interface layout would use the no creation relationship, while a new utility layout would use the create relationship. Your new booking script would go to the utility layout, go to the last portal row to generate the new booking record. But, this is a fairly old-fashioned approach. 2. Have only the non-create relationship, and the New Booking Script would look something like this: setVariable [$customerID, customerID] go to Layout "booking" new Record set Field Customer id, $customerID Commit Record You can expand this to enhance the end user experience. Perhaps generate a new window based on the booking table, set the foreign key and present the required data entry fields. Good luck.
Ocean West Posted July 21, 2007 Posted July 21, 2007 You need to use a $variable in your script, first set the $id variable to Customer_ID then navigate to the Bookings layout create record and set the booking_IDfk to the $id.
raymate Posted July 22, 2007 Author Posted July 22, 2007 Thank you both for your replies. Ocean West your way worked a treat, it does just what I wanted. Thank you :
Recommended Posts
This topic is 6334 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 accountSign in
Already have an account? Sign in here.
Sign In Now