Gloria Posted April 23, 2006 Share Posted April 23, 2006 I'm very new to FM 7 database. Could someone suggest a way to write a script to find the last record created. I created an inventory DB, everytime I enter a purchase invoice, I need to resort that invoice & print it. I have accomplished the sorting & printing but now I'm not sure how to find that last record. I thought I needed a function in the script but I don't know which function to use. Any suggestions would be appreciated. Thanks Quote Link to comment Share on other sites More sharing options...
LaRetta Posted April 23, 2006 Share Posted April 23, 2006 IIUC, you just want the last record in the table - why do you need to resort to print? FileMaker automatically keeps all records in their natural sort state of creation order. So Go To Record/Request/Page [ Last ] on unsorted table should do it (which is not a function but simply a script-step). You will need to begin with a Show All Records as well... but I wonder if there aren't better ways to do what you are trying to do. Because you can print the Invoice BEFORE ever leaving it; in which case, you won't have to find it again and vs. 7/8 allows multiple windows from same table with different found sets etc ... smiley-smile LaRetta Quote Link to comment Share on other sites More sharing options...
Gloria Posted April 23, 2006 Author Share Posted April 23, 2006 My apology's, I should have made my scenario clear. I enter purchases in the invoice, the purchases consist of "Product ID" & "Product Description", all these products have a "Catagory". I need to sort the invoice by the "Catagory" so that I can get the value of each different "Catagory". I then need to print the invoice in the sorted format so I can enter it into my accounting package by the Catagory totals. I usually enter at least 50 or more "Product ID"'s on every invoice. As I mentioned the layout I have created does what I need it to do except find the record I need. Right now I'm getting all the invoices on my report when I only want one. I did try inserting Go To Record /Request/Page [Last] into my script but it didn,t work. Quote Link to comment Share on other sites More sharing options...
LaRetta Posted April 23, 2006 Share Posted April 23, 2006 Hi Gloria, This doesn't sound like a standard Invoices/LineItems relational structure. Can you attach your file? smiley-smile Quote Link to comment Share on other sites More sharing options...
Gloria Posted April 23, 2006 Author Share Posted April 23, 2006 How would I do this, I tried a few times until I realized the zip file is 4.84MB & the max size is 976 KB. In reading your reply I also forgot to mention that the "Products" are entered through a portal on the invoice which would make a difference. smiley-cry Quote Link to comment Share on other sites More sharing options...
Maarten Witberg Posted April 23, 2006 Share Posted April 23, 2006 Try this as an experiment: upload it to http://www.yousendit.com, using your own email adress as recipient. Then copy the download link to this forum. The link is active for seven days. Or strip your file: delete all records save a few sample ones, all unnecessary layouts and graphics, all tables not related to your issue. Quote Link to comment Share on other sites More sharing options...
LaRetta Posted April 23, 2006 Share Posted April 23, 2006 Gloria, are you using a columnar list report with grouped data and sub-totals to get your totals per invoice Category? Because, if while on your Invoice, you use script-step of: Go To Related Records [ yourPortalRelationship here ; using that report layout (based upon the portal detail) ]. And then (also in that script-step) click 'Show Only Related Records' and 'Match current Record Only'. This just might do the trick because it will isolate only THAT Invoice's lineitems for your grouped report. I am relieved ... I thought you had 50 fields in your Invoice holding the products. If GTRR doesn't help, if you can't get your file attached here (or using kjoe's suggestion), don't worry - we'll still help you through this. We can always have you email your file directly to us - I can take 4MB. smiley-laughing LaRetta Quote Link to comment Share on other sites More sharing options...
Gloria Posted April 23, 2006 Author Share Posted April 23, 2006 Thankyou Kjoe, I striped the file of all the graphics to finally attach it here. My problem occurs in the Invoice Detail Layout, you will notice the Show/Print Invoice button uses the script Show Subsummary Report, this is where I need to have something incorporated into the script to find the invoice I just created. I also have another problem with this file but I'll deal with that later. I hope I attached the file correctly. Thanks for the guidence. [ATTACH]124[/ATTACH] Quote Link to comment Share on other sites More sharing options...
LaRetta Posted April 23, 2006 Share Posted April 23, 2006 Your Show Summary Report now works. You had a Go To Layout[] before your Go To Related[] step. Your Go To Related (GTRR) performs the Go To Layout within it. By going to the layout FIRST, it was picking up all invoices. See attached. smiley-smile So GTRR from Item Detail using your report layout (layout #10) isolates only that Invoice's detail, sorts it and then summarizes according to category for that Invoice. Quote Link to comment Share on other sites More sharing options...
Gloria Posted April 23, 2006 Author Share Posted April 23, 2006 Thankyou SO MUCH LaRetta, Would it be too bothersome if I asked for help on one more problem. I've been working on this file for so long I'm getting too confused. If you notice in the Item Price Info Detail layout I have another portal. I wanted this portal to display each invoice that the particular product was purchased on but I keep getting ALL the items purchased on the invoice. I've tried many ways to accomplish this (none correct) finally I duplicated the T.O. to set up another relationship to accomplish this, to no avail. What am I doing wrong!! Opps! Oh Really! Never Mind! Quote Link to comment Share on other sites More sharing options...
LaRetta Posted April 23, 2006 Share Posted April 23, 2006 I wanted this portal to display each invoice that the particular product was purchased on. You have that layout based upon Item Price Info Detail. But that detail (each individual Item detail record on the form) only ALWAYS matches ONE invoice. Change the layout setup to show records from Product Description. Then double-click your portal and change it to Invoice Detail and see what it gives you. It should provide all invoices that have ordered that product. When you look at your graph (starting from Product Description), you can see the invoice tracking ... from products, it matches Item on ProductID (grabbing all Items with that product). Then it switches to Invoice and grabs all related invoices. UPDATE: Oh, and you have a mix of fields in that portal. All the fields in that portal should be based upon Invoice Detail or Item Detail Information. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.