mlpremoli Posted December 1, 2014 Posted December 1, 2014 Hi all, I'm trying to make my code, more efficient. As far as I understand, global variables take memory that filemaker might use for other tasks. So, if this statement is correct, how would I free that memory? Should I set my variables to "" after using them? Any other way to do it? Thanks Regards. Mariano
bruceR Posted December 1, 2014 Posted December 1, 2014 Why are you using global variables in the first place? Do you really need them? Can you describe how you use them?
Wim Decorte Posted December 1, 2014 Posted December 1, 2014 http://www.soliantconsulting.com/blog/2014/01/all-variables-should-be-global-or-not 2
mlpremoli Posted December 1, 2014 Author Posted December 1, 2014 http://www.soliantconsulting.com/blog/2014/01/all-variables-should-be-global-or-not Thanks Wim, this link was really helpful and allow me to have a better understanding on how to manage variables. Probably, as I'm an intermediate and a learner, I was making a couple of mystakes. Thanks again. Regards. Mariano
mlpremoli Posted December 2, 2014 Author Posted December 2, 2014 Hi BruceR, thanks for your answer Let me give you my quick example which, by the way, doesn't mean I'm doing things right (at all) I have three layouts, L1, L2 and L3. I want to navigate from L2 or L3 to L1, In L2 and L3 I have a button, that basically says: "Go to L1:, and in L1 I have a "Go Back" button which takes me back to the layout I'm coming from. The way I have managed to achieve this, in L2 or L3 is setting a global variable $$myLayout, and assign the value of the layout with the Get (LayoutNumber) function when I press a button on L2 or L3. Then my "Go Back" button in L1 is a Go to Layout, script step and in the specify drop down I use "Layout Number by calculation" in which I use the $$myLayout content. I've tried with the GetScriptParameter function, but the issue is that in L2 or L3, when my script finishes sending me to L1, then I cannot get the parameter as the value doesn't last after the script finishes. Have I explained my self? Can I do this in a way avoiding Global Variables?
bruceR Posted December 2, 2014 Posted December 2, 2014 Yes, that is a good use for global variables. But - this whole thread is about setting a single global variable? If that's all you're doing, then you are a very long ways away from having any issue with globals and memory.
Lee Smith Posted December 2, 2014 Posted December 2, 2014 Please real field, layout, script, etc. named when describing your needs. This helps us see the logic in your schema. You can also attach a file, see here LINK on how to do this. A file will often help us to speed up the process of solving your questions.
Recommended Posts
This topic is 3713 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