Kent Searight Posted December 27, 2005 Posted December 27, 2005 Hi all, Since I gleaned so much useful info from the terrific responses from forum members in my Local Vs. Global Variables topic, I was hoping to gain some more knowledge on the topic of repetitions in script variables. Basically what I'd like to know is if anyone is using this feature, and why. Are repetitions of variables any more (or less) useful than repetitions of fields? I was actually a bit surprised to see repetitions as an option when FM8 introduced script variables, considering the already limited use of field repetitions by many experienced developers. After I "discovered" field repetitions and went through the "wow, look how you can write an entire solution with one field" stage (and then abruptly found myself painted into a corner), I find myself using field repetitions for very few things outside of storing graphics (which obviously won't work in variables). So, what's the deal? I'm interested in hearing anyone's take on this subject! Thanks in advance!
Wim Decorte Posted December 27, 2005 Posted December 27, 2005 reps in variables are immensely valuable. It's as close to arrays you can get in FileMaker. Arrays are collections of similar data. Instead of declaring a bunch of variables, each one to store a record ID for instance, you can declare one variable with many reps for it. A cool fact about variable reps is that they can be non-continuous: they don't need a value for each repetition. You can have myVar[1] = someValue myVar[3] = someOtherValue and myVar[2] without any value at all
Kent Searight Posted December 27, 2005 Author Posted December 27, 2005 Thanks for the reply, Wim! One thing I think I'm getting from your response is that the number of repetitions in variables isn't static (as compared to a predefined number of repetitions for fields). So, to use your example, if recordID's need to be stored in a variable, the number of repetitions can be defined on the fly with a calculation without ever worrying about exceeding the limit of predefined repetitions. Is that assessment accurate?
Wim Decorte Posted December 28, 2005 Posted December 28, 2005 That is correct. There is no need to "resize the array" to store more info in it.
Recommended Posts
This topic is 6908 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