wingwalker Posted October 10, 2006 Posted October 10, 2006 Hi everybody, I don't understand why something will work perfectly in one TO but not another. The follwing script works perfectly in my Customer file but not in my Vendor file. The Vendor TO is a duplicate of my Customer TO and are related to the Letters TO in the exact same way Customer_Letters and Vendor_Letters. The portals are as they should be and the fields are correct as are the layouts and you can see that the script is the same as well. But the portal in the Customer layout works fine and the Vendor does not. In the Customer layout I click the New button which calls the following script and goes immediately to the Customer_Letters layout. When I go into the Vendor layout and click the New button which calls the following script, the Date is entered into the Date Created field on the Vendor Entry layout and the curser moves to the next field which is “ActionType” which is designated as a “Do not enter in browse mode” on my Vendor Entry layout where the script is called. I then get a dialog saying “Carriage return cannot be entered. Either press the tab key of click directly into another field”. I then of course have to click on the Revert button to clear out. I’ve looked at everything I know to look at and hoped you guys would know what I’m doing wrong. Or what would cause this to happen. There is no place in the script that calls a Carriage return. Weird! Set Error Capture [ On ] Freeze Window If [ Get ( ScriptParameter ) = 1 ] Go to Field [ Customer Letters::Date Created ] Go to Portal Row [ Last ] Set Field [ Customer Letters::Date Created; Get ( CurrentDate ) ] Go to Related Record [ From table: “Customer Letters”; Using layout: “Customer-Letters Entry” (Customer Letters) ] [ Show only related records ] Go to Field [ Customer Letters::ActionType ] End If If [ Get ( ScriptParameter ) = 2 ] Go to Field [ Vendor Letters::Date Created ] Go to Portal Row [ Last ] Set Field [ Vendor Letters::Date Created; Get ( CurrentDate ) ] Go to Related Record [ From table: “Vendor Letters”; Using layout: “Vendor-Letters Entry” (Vendor Letters) ] [ Show only related records ] Go to Field [ Vendor Letters::ActionType ] End If I could sure use your help. Thanks a lot,
Fitch Posted October 10, 2006 Posted October 10, 2006 Not sure, but look at the layout setup and see if the "save record changes automatically" checkbox is set the same on both layouts.
wingwalker Posted October 10, 2006 Author Posted October 10, 2006 Hi Fitch and thanks for the reply, Both layouts have the "save record changes automatically" checked. I'm sure you're doing the same as me, just going through the possibilities. I've taken a full day going through everything I can think of and then going through it again and keep coming up empty. It has to be something so simple and so obvious that you miss it is all I can think. Please let me know if you think of anything else. Maybe a different script, I don't know. James
Fitch Posted October 10, 2006 Posted October 10, 2006 Have you tried stepping through it with the debugger?
wingwalker Posted October 10, 2006 Author Posted October 10, 2006 Hi Fitch, Yes and the script runs but it does not go to the Vendor Letters layout. It stays on the Vendor Entry layout where the script is called and proceeds to make a new record in the Vendor Letters Portal.
BobWeaver Posted October 10, 2006 Posted October 10, 2006 I don't know why it would work in one TO and not the other. Entering the date in the last row of the portal will create a new record in the related table, but the link back to the parent record is not established until the related record is committed, and therefore a GTRR won't work, leaving you on the original layout. So, I would try adding a Commit records step before the GTRR.
wingwalker Posted October 10, 2006 Author Posted October 10, 2006 (edited) Yep, that did it. I don't understand why it doesn't work without it when the script works perfectly in the Customer layout. But this works and I'm a happy happy boy. Thanks Bob, this thing was starting to get to me. James Edited October 10, 2006 by Guest
wingwalker Posted October 11, 2006 Author Posted October 11, 2006 Sorry Bob I spoke too soon, Once I have a letter created and it’s showing in the portal. When I press the button to create another record, it creates a new record in the Vendor Letters layout and I go to that layout all right. But it does not go to the new record that was created. It’s on a previously made record. What would you do with the script to correct that? Right now I have the script shown above with the following change made to #2. After the Set Field is. Commit Records/Request [skip data entry validation; No dialog] James
Fitch Posted October 11, 2006 Posted October 11, 2006 When you commit a record, it exits the portal, so GTRR will just take you to the first related record. You'll need to another script step or two to take you to the correct row before you GTRR. E.g.: Set variable($row;Get(PortalRowNumber)) Commit Go to portal row($row) GTRR
wingwalker Posted October 12, 2006 Author Posted October 12, 2006 Thanks so much for your help. After the "Go to Related Record" step, I added "Go to Record/Request/Page [Last] and that did the trick. Again guys, thanks for your help. James
Recommended Posts
This topic is 6619 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