Ben Ball Posted December 5, 2005 Posted December 5, 2005 I am experiencing problems with adding sub-scripts to a "main" script(1). My main script already has a subscript(2) within it. This all works fine. I have another script(3) that also works fine on its own. I have tried to incorporate this third script into my "main" script (1). However, the script(3) does not work correctly once it is added as a sub script to the "main" script(1). Is there certain steps/criteria I should be adding into my scripts to ensure sub scripts work correctly?
LaRetta Posted December 5, 2005 Posted December 5, 2005 Hi Ben, Not enough information ... Can you post your scripts or a demo file showing what doesn't work for you?
Ben Ball Posted December 5, 2005 Author Posted December 5, 2005 Hi LaRetta, I have posted the script as a scan. I hope this helps. Basically, I have almost got it working, all steps work apart from the last op (perform script ["update stock qty 2"] This script does not function at all. The script itself works, but only if its assigned to a button on its own. Thanks..
LaRetta Posted December 5, 2005 Posted December 5, 2005 That last script should work fine ... except ... Scripts fire depending upon the layout they are on at the time. In that last script, do you have a layout switch to the proper table occurrence? If it fires from a button, it must be on the same table occurrence as the one the button is on. Otherwise, it's firing on the wrong TO and won't work. Also, do you have a script parameter attached to that button?
Ben Ball Posted December 5, 2005 Author Posted December 5, 2005 Thankyou for your time... In that last script, do you have a layout switch to the proper table occurrence? Ans. No I don't. I am not sure I know what you mean by a layout switch? How do I tell which table occurance the script is firing off? As I say, the scripts work independant from the same layout, in the same portal window. (FYI. The script button is located on a portal row within a portal window. Not sure if this is a contributing factor? Also, do you have a script parameter attached to that button? Yes, I had, a script parameter which is now redundant. I have now removed it.
LaRetta Posted December 5, 2005 Posted December 5, 2005 (edited) "FYI. The script button is located on a portal row within a portal window. Not sure if this is a contributing factor?" Yep. Can you post that last sub-script for us? Because, how can a script (fired based upon the existing layout) know which row (related record) it's supposed to work on? "How do I tell which table occurance the script is firing off? " Scripts always fire based upon the table occurrence they are on. You would tell by going to Layout mode, then Layout Setup and seeing which TO is listed in the popup. Since the script bases itself on the main layout, it's not firing on the portal records. We need to see that script ... Is that script parameter really redundant? That parameter probably pointed to the related record to act upon, no? Edited December 5, 2005 by Guest
LaRetta Posted December 5, 2005 Posted December 5, 2005 Okay, that last sub-script "Update Stock Quantity" ... on a related record? That's your problem. Which related record should it be setting? It's probably setting the first one ...
Ben Ball Posted December 5, 2005 Author Posted December 5, 2005 (edited) Yes, of course. I have posted the script for you too see. I te does include a related record function. Probably does'nt help either?? Would I just be better off including the whole sub script into the main one?? Then it would know? No? Also, yes, I believe the script parameter, I was, using, is redundant as I was calling it up for something else intially. Not related to my problem. FYI Edited December 5, 2005 by Guest
LaRetta Posted December 5, 2005 Posted December 5, 2005 (edited) As you can see, that first Set Field [] can't act. It doesn't know the portal row number because you're not in a portal when you set your global. That script parameter which you thought was redundant ... isn't. UPDATE after your update ... well no - just including the sub-script in the main won't help. The problem is isolating the specific related record you want to work on. But I don't understand your process here. Why do you need the portal number at all? I think there are much easier ways to accomplish what you're trying to do. Can you post a sample file? I see no need to jump around like you're doing. And I wouldn't use copy/paste either... Edited December 5, 2005 by Guest
Ben Ball Posted December 5, 2005 Author Posted December 5, 2005 So, if I create a script parameter, and assign to the button in question. As per how I had it. How do I get the sub script to pick the same parameter? It did'nt recognise before. I will have to have another play I think. Sorry if I am not getting it quite. Thanks for your time..
LaRetta Posted December 5, 2005 Posted December 5, 2005 I suggest you post a sample of this scripting process. Once we see the process in action, we'll be able to help further. Simply, you can't 'pick up' a script parameter from a button only via script ... a User must press the button. Script parameters can be passed to the sub-script after a button press. I'm suggesting you re-think what you're doing here. There are certainly easier ways. And there are many people here willing to help you. I have to leave. Hopefully others will help you through this. If not, I'll check in when I get home late tonight. LaRetta
Ben Ball Posted December 5, 2005 Author Posted December 5, 2005 Hi LaRetta, I have since been trawling through ideas, trying to apply some of your theory. I have made it work, however. I am not so sure it is the easiest way. I have incorporated it all into one script. I have also removed the need for copy and pasting. Yes, not good for this application, or any infact. Please view the script attached. If there is an easier way then I would love to know what it is. The flavour i've been chewing does'nt taste so good after 5 hours or so. If you know what I mean. Thanks for your advice. It has helped tremendously. Still to be improved I am sure. Regards, Ben
Recommended Posts
This topic is 6930 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