Jump to content
Sign in to follow this  
raymate

How can this be done without portals?

Recommended Posts

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 by Guest

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

Thank you both for your replies.

Ocean West your way worked a treat, it does just what I wanted. Thank you :

Share this post


Link to post
Share on other sites

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
Sign in to follow this  

×

Important Information

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