hartmut Posted October 8, 2013 Posted October 8, 2013 Hi I am trying to make a simple invoice and catalog database for a friend. I get how to do it for the most part . I don't know how to script adding a new repetition when necessary. I have included a sample of the file but presently when I press the add button in the pricing database, it causes a lookup for the other information in the invoice layout but only under a new record. Could someone show me how to make it add to a new repetition when necessary using the add button but not making a NEW record. Thanks Very Much Dave Sherry Store.fmp12.zip
eos Posted October 8, 2013 Posted October 8, 2013 Any specific reason to use repeating fields instead of a related table?
hartmut Posted October 8, 2013 Author Posted October 8, 2013 There is no reason. I just didn't want to add new records. My layout invoice is the invoice. And needs only one record with several entries. I don't know of any other way to do it. It seems a related record would also add new records. I am just trying to make one invoice at a time with several items in it. I thought repetitions was the only way to make several entries in one record. You can see what I am trying to do in the file. I might add that I want to user to click on the record in the prices layout and and using the "ADD" button to send that number (Item Number) to the item number field in the invoice. Then the look up would provide the information from the prices table. The problem is that it makes new records. I want to do what i am describing without creating new records. That is why I am trying to use a button to send the info to the next open repetition in the record. I don't know how to script doing that. Thanks Dave
eos Posted October 8, 2013 Posted October 8, 2013 My layout invoice is the invoice. And needs only one record with several entries. I don't know of any other way to do it Using repeating fields for your business data is not recommended. The normal(ized) structure would be Invoice --> LineItems <-- Products, where every record in LineItems does what you want a repetition to do, except that you: – don't need to store (and possibly change) the same data in different places – can add as many line items as you want – can design your invoice printouts in a flexible, summarized way – can very easily create summaries on products and dates But if you are bent on using repetitions, you should at least design you invoice layout to show them. Here's one way to do it, but this is only meant as proof of concept. Honestly, consider using a relational structure, even if it's just a quick job for a friend. PS: If someone knows a faster/better/easier way to get at the last empty repetition – not interested! Sherry Store_eosMOD.fmp12.zip 1
hartmut Posted October 8, 2013 Author Posted October 8, 2013 THANKS for you help.. I was looking around and I found an example demo invoice that was posted that is what I want to do but I can't figure out how to use my "ADD" button with this method. How can I script the data to go to the next entry location in this related table example. I am enclosing the file to show you So in this case with the related table (which I agree is a much better solution) How can I script an "ADD" Button in the lineitems layout to add the LineID to the VERY NEXT line in the invoice in the INVOICE layout. That is all I am missing to do Your modifications work but I would just like to know how to do it without the repetition as in this file. Thanks DaveInvoicesDemo Copy.fp7.zip
eos Posted October 8, 2013 Posted October 8, 2013 I would just like to know how to do it without the repetition as in this file. That's very laudable! In the file as it is, on the Invoice layout there is a value list on the ProductID field in the portal; if you use the spare (final) row to select a ProductID, you are creating a new line item ID for the invoice, which automatically receives the invoiceID via the relationship, and the ProductID from your selection. Then you can set the quantity, and that's (basically) it. Here's another way to add a product, using a picker portal (via a new relationship) and some error trapping. This method lets you filter the product list and can show more information than a value list, but of course it needs more space. If you try the print script, you'll see how much more flexible a summary layout is compared to repeating fields. InvoicesDemo_eosMOD.fp7.zip
comment Posted October 8, 2013 Posted October 8, 2013 So in this case with the related table (which I agree is a much better solution) How can I script an "ADD" Button in the lineitems layout to add the LineID to the VERY NEXT line in the invoice in the INVOICE layout. That is all I am missing to do That makes very little sense. You do not want to add a LineID to the invoice; you need to select a product and create a new line item with that product's ProductID. Also, you want to be on the Invoices layout when you do that. See a demo that does exactly that posted here: http://fmforums.com/forum/showpost.php?post/355429/
Recommended Posts
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