JTSmith Posted April 28, 2012 Posted April 28, 2012 So I have 2 tables: Customers & Jobs On the Jobs layout, I have a drop down list of Customers, so I can select which customer the job is for. What I would like to do is be able to type in a NEW customer in the Jobs layout, in the Customer field, and since the customer's name is not in the drop down list, it would create a new record in the Customer's table with the name . Am I overthinking this one? Thanks...
doughemi Posted April 28, 2012 Posted April 28, 2012 In the relationship dialog, check the "allow creation of records in this table via this relationship" box on the Customers side.
bcooney Posted April 28, 2012 Posted April 28, 2012 JT, May I suggest that new jobs are created from a Customer Form layout. This way, a user can find in Customers, add New if necessary, and then click "New Job." I typically have a portal of jobs on a customer form and an "Add New" button above the portal. Each portal row has a "view" which does a gtrr. hth, Barbara
LaRetta Posted April 28, 2012 Posted April 28, 2012 There are times it is helpful to create a parent from a child table (customer from an Invoice or jobs) but keep in mind that you are removing the expectation that the User fill in all the Customer fields by allowing them to enter just a 'name'. If you instead open a popup window for a new customer, or switch to invisible tab with customer details then the User can see (and fill in) all required information. Nonetheless, there has been times when a single entry into a related field is fine so here is one way (attached). Since you are using drop-down, you will need two fields anyway (one which holds the CustomerID with the drop-down attached and the other which holds the customer name), so you can use these two fields (stacked) to accomplish what you wish. Brief description: Drop-down is popped open then if User doesn't make a selection within two seconds, it drops them into the Customer Name field underneath. In graph, Customers has 'allow creation' turned on. When User types into the empty customer name field, it inserts the CustomerID into your Jobs CustomerID and leaves the name displayed. If you can live with the timer then it might work for you. NewCustomer.zip
Vaughan Posted April 29, 2012 Posted April 29, 2012 Thanks for the sample file. This creation of parent records has been an issue for me for years. I've see quite a few techniques but none have been "perfect", they've always had some kind of "hack" feel to them. I've done one solution that I fear will come back to bite me some day. It uses a pop-up menu with a numeric primary key for the customer. The pop-up menu is set to allow entry of other values, which when selected makes FMP display a text dialog natively. Users enter the new Customer name. A script trigger on the field object then checks whether the entry is a valid primary key, and if not creates a new related record, sets the customer name and replaces the customer name with the new pk. Still a bit hacky but it has been working in production for a couple of years now.. :D 1
Recommended Posts
This topic is 4652 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