VariablesSimulating a Basic Key / Value ArrayPosted by: aflgenx / Thursday, September 27, 2007 – 9:04pm
Alright guys, been busy so pardon the greater than one month gap. This is more on the whole numeric addressing issue we have with repeating vars and fields... its really annoying and puts limits on what can be achieved. So, we want to simulate text based key's that are available in every programming language known to man - one method I don't mind (though i haven't extensively run speed tests on it): Custom Function: getValueFromArray( array ; key) Method for setting the key / value array: Now, so lets say we wanted to extract the value for sentance from that array: I hope this has been a fun and eductational experience ;) Cheers guys, will try build a bit on this and run some speed tests over the next few weeks, in the mean time, behave yourselves!! Dynamic VariablesPosted by: aflgenx / Tuesday, June 26, 2007 – 7:10am
Hi Guys, I recently had the need (or more likely the desire) to set global variables dynamically.. As most of you will know, Set variable allows you to specify a dynamic value and repetition, but not a dynamic name for your variable. This often leads you to store info in a delimited list within one repetition when you need to store multiple peices of information per one subject. This will soon make your scripts become messy and the logic harder to follow Hence two small custom functions: Custom Function: SetGlobalVariable( name ; value ; repetition) Example Usage: SetGlobalVariable( "record_" & table::primaryKey ; table::aField ; 1 ) If your primaryKey field contained "991" and your aField field contained "Alex!!" - Which means that if you were to now retrieve the value of $$record_991 - you would get "Alex!!" as the value returned. Call: GetGlobalVariable( name ; repetition) Custom Function: GetGlobalVariable( name ; repetition) Example Usage: GetGlobalVariable( "record_" & table::primaryKey ; 1 ) These examples aren't great, but they certainly simplify my scripts and I hope they'll help someone else out. |
Be Notified!Let us tell you when a new video is posted. We'll send you an email with a direct link right to your email inbox.
Make sure and whitelist (or add to your address book editor@filemakermagazine.comFileMaker Reference Tool
* $29.99 is the FMPug member price for a printed copy. 10 Most Recent Videos
|