Have you made any design changes to this solution just before you saw this problem?
If not, try this experiment: immediately after entering the new customer information, click a blank area of the layout to commit the new record, then click the new invoice button.
If that fixes the issue, you can insert a commit records step as the first step of the script that the button performs to take the place of this extra mouse click.
Thanks Phil, I have made design changes. When I close the solution and reopen it the new customer is there ( I am not sure if that means the record has been committed) but when click the new invoice it still gives me an invoice with a different preexisting client.
Yes, closing and re-opening will commit your changes.
You told me what happens if you click the layout background before clicking the button.
I don't know how to tell if they are committed by clicking the layout background, but as I mentioned even when they are committed by closing and reopening the same problem occurs when I hit new invoice
If you click the layout background the data will be committed.
My question here is what then happens on the layout when you click the button to create a new invoice? Do you see the correct results?
This is a quick and easy test to see if adding commit records to the button's script will resolve this issue or not. If clicking the layout background is all you need to get the button's script to work consistently correct, then we know how to fix the issue. If clicking the layout background does NOT change the results we see when you click that button, then we need to investigate further. (Closing and Re-opening the file does commit the records, but it also causes a full refresh of the layout and all data references, so there could be more involved here than something we can fix with a commit records script step.)
yes the data does get committed when I click on the background but when I click new invoice it continues to create a new invoice with the wrong customer
Which means that committing the current record is not the issue.
Have you modified any of the scripts involved?
In the unmodified starter solution, there's a step at the very beginning of the script:
Set Variable [$$CURRENT_CUSTOMER_ID ; value: Customers::CUSTOMER ID MATCH FIELD ]
This loads a global variable with the ID of your new customer record.
Then the match field in invoices has this auto-enter calculation:
which will copy the current value of this variable into the match field and thus link the invoice to the customer record with that ID.
Here are several ways that could fail:
- $$CURRENT_CUSTOMER_ID might not get a value when the button for adding an invoice is clicked.
- $$CURRENT_CUSTOMER_ID gets the wrong value when it is clicked
- The value of $$CURRENT_CUSTOMER_ID gets changed, possibly by a different script performed by a script trigger before New Record/Request creates the new invoice record.
- The name of this variable was changed in the script and not in the auto-enter calculation or vice versa.
- The CUSTOMER ID MATCH FIELD does not contain unique values or, for some customer records, the field is empty.
I am a bit slow with this but through your suggestions I am making headway, I have checked my altered invoice script against the original ,under the "add invoice by customer they are the same scripts. This leads me to think it is one of the five problems you mentioned, I think it might be the customer ID value, can you tell me where to see it under the individual customer and then the new invoice that I create?
Have you imported any of your contact information? This is the most common cause of getting missing contact ID's in a stater solution. If this might be the case, See this thread: Help importing Excel data into a Filemaker Starter solution
It deals with a different file in the starter solution portfolio, but the problem and the ways to correct it are the same.
You can look for missing or duplicated values on any layout based on the customers table. You can use the field tool while in layout mode to add CUSTOMER ID MATCH FIELD to your layout or you can switch the layout to Table View and click Modify to bring up a dialog where you can add this field to the view. Since Table View lists each record as a single row of data, this is a very good way to check this field over large numbers of records.
With the field in your table view or added to a layout, you can also enter layout mode and enter a lone ! to find records with duplicate values in this field and you can put a lone = in the field to find all records where the field is empty.
I have added the customer ID match in the field on both the customer and invoice. Here is what is very interesting, when I create a "new" invoice from a client that I imported from an older solution the new invoice matches and the ID is the same. When I create a new invoice from and new customer I have just added the customer ID is different.
I have just seen your last post will take a little break and give it a try, thank you
I just saw the above post I will give it a try
can you confirm that the steps from the link above are likely the correct solve, I can see exactly what the problem is now
When I add a new customer it will give me a three digit number like150 when I click new invoice, FM searches for the customer id and comes up with CUST000150 the CUST000 the prefix from the solution I imported.
Phil Thanks for all your help, I have just resolved it in a different way,
I went to manage data base,
then when to the field name - customer ID match field
clicked on options,
then set the next value higher than the total of all the customers I imported, I test this and it worked