Zcast Posted January 22, 2010 Posted January 22, 2010 (edited) Can someone please look at the attached file, and tell me why I would be getting a blank first portal row? Maybe I have my script set up wrong? I'm trying to get it where when I add a "stop" on the "loads" layout, it is automatically entered in the portal, and in the stops table. Thank you. Download file from here: http://www.crazyjamz.com/test1.zip until they get file attachments fixed, Thanks. Edited January 22, 2010 by Guest added download link for file
Zcast Posted January 22, 2010 Author Posted January 22, 2010 I have added a download link of my own to my original post. Thanks.
LaRetta Posted January 23, 2010 Posted January 23, 2010 (edited) Okay, in your Stops2 script ... You have a layout based upon LOADS. It is related to Stops_LINES (your portal) and you have Allow Creation on to the Stops_LINES table based upon LoadsID. This is all okay. But then the issues begin: 1) Not globals in Custom Dialog: Do you think you are using global fields in your Custom Dialog to insert the business name and address in Stops? You aren't (even though the field names begin with g). They are standard fields. You can drop the gBusiness Name and gAddress and use your real Business Name and real Address there but you need to change them to be based upon your Stops_LINES table occurrence and not Stops. If you use Stops, it will not automatically insert the LoadsID into the Stops table. 2) Unnecessary script lines: Disable and eventually delete your script lines 3 - 7. They aren't needed. Now your script will work as you expected. You have no need to capture the information again in a variable because when your User types the business name in the Custom Dialog, it automatically creates the Stops record for you. Nor do you need to Go To Portal Row [last] nor set the Stops fields again with the variable for same reason. I would also suggest that you remove the 'Allow Creation' between your Stops and Stops_Lines tables. One more thing ... in your Stops_Lines portal, you have drop-down list on your pk_StopsID. That field shouldn't even be in the portal because (or at least disallow entry by Users). That number is an auto-enter serial from your Stops table and you never want to touch that field. Let us know if you need further help with it. UPDATE: Everywhere I said Lines, I meant Loads. And the Stops were Stops_LINES. ROFLAMO - it's late here! I think you understood but I'll go ahead and correct the post anyway. Edited January 23, 2010 by Guest Added update and corrections
Zcast Posted January 23, 2010 Author Posted January 23, 2010 Wow! Really had that one screwed up! Thanks for all your help LaRetta.
LaRetta Posted January 23, 2010 Posted January 23, 2010 My pleasure. I've been there and others have helped me through it. Have a good weekend. :smirk:
Zcast Posted January 23, 2010 Author Posted January 23, 2010 (edited) Alright LaRetta, I did everything you said to, but there is still one little problem...while my portal is empty...clicking on the add stops buton, and filling in he necessary info, will fill the first portal row with the same information..but when I go to dd a second stop to the portal, it just overwrites the first portal record info, instead of going to the next portal row. I've attached a pic of the stripped down script for the add stop btn. Thanks again for the help with this. Ok, attachments aren't working again, but here it is: Allow User Abort (off) Show Custom Dialog (With what you suggested changed) Commit Records (No Dialog) That's it. Edited January 23, 2010 by Guest added script step
LaRetta Posted January 23, 2010 Posted January 23, 2010 My apology, for some reason I thought you were setting the 'one' side (stops) here. Upon a good night's sleep, I realize it is Loads as in Trucks and Stops as in truck deliveries. So you can't directly set the actual business fields and must use globals and you must create the new record by action and not just setting the fields. So take your original file. Make your gBusinessName and gBusinessAddress true globals. Delete out the variables (you don't need them). Leave your Go To Last Portal Row also. And, set your real business name field with the gBusinessName instead; same with BusinessAddress. Globals can be accessed from anywhere. But ... you are setting ALL your Stops fields using globals then. And you have a global field for every real field! You would only need a few globals which you would clear at the end of your script for next field use. However, you will lose the ability to validate, ie, if User types Sept 22 into the custom dialog when you are asking for Delivery Date, that invalid value will go into the Delivery date. You will have to add your own validation to protect that the data entered is correct. It would be easier to work directly in your Stops layout or even include all fields in your portal (or tab panel) and just let the User type directly into the fields. If you are interested in a different approach to this process, let us know. :wink2:
Zcast Posted January 23, 2010 Author Posted January 23, 2010 (edited) Thanks Laretta. I'm always interested in newer approaches to solving problems; that's how I learn! I was thinking about just creating a "pop-up" window with the stops layout on it, and going that way...probably would be much easier...ha ha. I just dont understand why it wouldn't work the other way....the script always created 2 records in the "stops" layout?? I've reattached the "fixed" file to show changes in the "add stops" script...I must be doing something wrong in the script... downloaded file from: http://www.crazyjamz.com/test2.zip Edited January 23, 2010 by Guest added link to my file
LaRetta Posted January 23, 2010 Posted January 23, 2010 You are still missing the concept that you have 'Allow Creation' on. What that means is that, when on Loads layout and you set a Stops_LINES field (any field but the ID) in that last portal, you automatically create a new Stops record anyway. So there is no need to go to the Stops layout and create a new record or set the fields. So you will want to delete all lines from Stops script line 10 (where it starts by saying Go To Layout [ Stops] down through line 23 (where you return to the Loads layout). And be sure to change the rest of those Set Fields[] to pulling data from the globals as well. I would also add a Commit at the end of setting the globals so you exit the portal. But you see that, by not using the Stops layout and letting Users type directly into the fields, you don't have only ONE field of each type, you will require TWO (one regular and one global) in your field definitions. And you will need THREE script lines for every field they enter, 1) capture value from custom dialog into global, 2) set the value from the global and 3) clear the global. It tired me out just working with so many lines. But I understand completely wanting to know what it was doing and, by you sticking with it until the principle is planted, you will learn a lot more than many people who would have just shrugged and changed their process not understanding why. I salute you for it. :waytogo:
LaRetta Posted January 23, 2010 Posted January 23, 2010 (edited) By the way, I don't understand why you are using the Stops_LINES table occurrence anyway. Unless your real structure is much more involved, you should join Stops::_fk_loadID directly to Loads::_pk_loadID. This is your primary relationship between the two. You will need to change pointing your portal and script lines to the Stops table but it will be worth it; less confusion of which Stops table occurrence is being referenced. :wink2: Edited January 23, 2010 by Guest
Zcast Posted January 26, 2010 Author Posted January 26, 2010 Thanks Laretta for all your help. It turned out to be just be a simple little script that I needed (Instead of that Monster script I had), along WITh using the stops_LINES TO. My next question that maybe you can help me with is this: Invoices layout three fields plus the stops_LINE portal pk_InvoiceID fk_CustomerID fk_LoadID I have all the "key" fields working together, but when I pull up the Load ID, it populates the portal with all my stop info, but when i create a new record, and attempt to do this, it simply adds additional info into an "already" invoiced load. I will add the sample file ASAP. What would be the best way to "pull" all of my portal information out, to place onto an invoice layout? Any suggestions?
LaRetta Posted January 26, 2010 Posted January 26, 2010 You are right, it would greatly help to see the file (particularly since I said you could delete the Stops_LINES table occurrence. I'd like to be sure you're on right track. What would be the best way to "pull" all of my portal information out, to place onto an invoice layout? This is a business decision. If you want to display the customer's phone number on the invoice, just grab the related customers::phone field and place it on the form and same with any customers fields. But sometimes a business wants to track the address at the time the invoice was created. In this case, you would want to include an address field in Stops and then, through auto-enter on that field, use Lookup. I'm pleased to see you moving along! :laugh2:
LaRetta Posted January 26, 2010 Posted January 26, 2010 Well, I hate to suggest you change your file again. But the Stops_Lines table occurrence is redundant and can be removed. You can attach Stops::LoadID = Loads::LoadID. I realize that will take some changing of your portal table occurrence and script but it really would be cleaner and, in that way, it won't haunt you down the road. With your current situation, I'd like to find out how a customer is invoiced. Are they invoiced after there have been many loads for them? Or after a single load (which may or may not have multiple stops?) Your structure should look like this (I think) but I'd still like clarity on what is being billed (assuming a customer can be invoiced for multiple loads): Customer -< Invoices -> loads -< stops However, your current break in your script is because you are going to the field in the portal before going to the last row. Reverse those lines two. :smile2:
LaRetta Posted January 26, 2010 Posted January 26, 2010 Oh, also, your portal keeps jumping back to the top. If the User clicks out of the portal while making a new record, it would seem to disappear on them. You might consider (while in layout mode), selecting the portal then Format > Portal Setup and uncheck the box 'Reset scroll bar when exiting record.'
Zcast Posted January 26, 2010 Author Posted January 26, 2010 Hey LaRetta, "Ideally" I would like the choice of being able to invoice a single load, or multiple loads at once; but realistically Loads would probably be billed one load at a time.
Zcast Posted January 27, 2010 Author Posted January 27, 2010 Ok, I've got everything working right, except that new stops get added to "every" load, instead of just the one load. I'm sure that's a relationship issue, but not sure which way it should be set up. I got rid of the stops_LINES TO, and just went straight with stops. Works great, like you suggested it would.
Zcast Posted January 28, 2010 Author Posted January 28, 2010 Ok, my brain is about to fall out!! Got the stops working ok..they add to the loads just fine...now Im just having problems with the Invoices Layout...when I choose a contact on the Invoices Layout..it pulls up the load numbers to choose from, but it is combining stops from different loads into the same invoice when I create a new invoice record...any ideas on how to setup the relationships between the tables to eliminate this from happening?? I've once again attached the "new" file. test_Copy.zip
Zcast Posted January 28, 2010 Author Posted January 28, 2010 This is a new question, brought from an old topic. I have an Invoice Layout which pulls up loads, and stops into a portal..all that works just fine. When I go to invoice the load..it seems to work fine as well..the problem is when I go to create a new invoice using a previous contact, it adds the new "stops" onto the already existing invoices, and pretty much overwrites previous entered information for loads and invoices. I have included the file for reference..I know it's a relationship issue, just don't know where! Realistically, this is what should happen..New Invoice...choose which load...pulls up stop info from that load..WITHOUT other stops for the same contact being entered into every invoice! Thanks ahead of time, and thanks to LaRetta for the previous help on this file. test_Copy.zip
bruceR Posted February 27, 2010 Posted February 27, 2010 (edited) Well, it's doing exactly what you told it to do. What do you WANT it to do? Seem like you would want multiple invoice for customer; and each invoice would have different stops and different loads associated with the stop. But that's my guess at how this works. What does each invoice cover? I see the relation recommended previously was: Customer -< Invoices -> loads -< stops But that's not what you did. You did: Invoices ->Customer -< loads -< stops And that is the source of your problem. See attached, particularly contact layout. Very quick and dirty but hopefully you get the idea. test_Copy.fp7.zip Edited February 27, 2010 by Guest
Recommended Posts
This topic is 5452 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