jimkent Posted July 24, 2003 Posted July 24, 2003 Ok, so I'm completely confused. Being that I'm a relatively new User of FM. I just can't seem to figure out how to define or use arrays. There are no mention of them in any books I have or the Help screens. I'm sure I'm missing something there must be another name for them in FM. Can anyone point me in the right direction? Thank you.
Helpful Harry Posted July 25, 2003 Posted July 25, 2003 FileMaker isn't a programming language and doesn't have an in-built real Array structure as in MyArray[1,5] - except for repeating fields which are technically one dimensional arrays (ie. MyArray[5]). It depends what you're trying to do, but there's usually a way around needing real arrays.
danjacoby Posted July 25, 2003 Posted July 25, 2003 The closest you can probably come to an array would be to view a layout in Table view. It's not really an array; it looks like a spreadsheet. The real question here is, what exactly are you trying to accomplish with this array?
jimkent Posted July 25, 2003 Author Posted July 25, 2003 Well, I guess I can use a "One Dimensional" array (Repeating fields?) but I don't understand how. What I'm doing is making an interactive flow chart. Each item (a container field) on the flow chart is a "stage" and each Layout has 10 or so stages. What I call each stage it is: Stage 1, Stage 2, Stage 3, and so on. When a user clicks on the flow chart graphic (usually a rectangle or circle or something) it sets the graphic to another color indicating that the stage has been completed. I can do this by scripting each and every button. But, what I would like to do is run one script that tests (by looping) through each stage. i.e. stage(1), stage(2), etc. and change it appropriately. I know it sounds complicated. I'm sorry.
Helpful Harry Posted July 26, 2003 Posted July 26, 2003 I would say the "easiest" way (unfortunately) would be to set each stage up as it's own field and it's own button and script. Depending on how your layout needs to look you could perhaps use a repeating container field, but you'd still need separate buttons and scripts. Repeating fields can be useful in some circumstances, but there's no way in FileMaker 5.5 (I've a vague recollection of someone saying FileMaker 6.0 fixes this problem) or earlier to set a particular repetition from another field value, which means you HAVE to hard code the number, ie. you can't Set Field (Stages, StageNumber), you can only Set Field (Stages, 3).
jimkent Posted July 29, 2003 Author Posted July 29, 2003 Well, thank you for thinking! I did set up each stage and it's own button and script. And it works, The only bummer is when I make a change to the behavior of each button, I gotta go through each script one-by-one. Oh well..... Thanks!
jimkent Posted July 29, 2003 Author Posted July 29, 2003 How do you get a layout to display only, say the 3rd feild of a repeating field. I guess I could define another field and "set" it but that's like doing two fields for one. I'm stuck....
LiveOak Posted July 29, 2003 Posted July 29, 2003 Another option is to store your colors each as a separate record in a related file and change (by computation, loop, or whatever) the key to change the color. -bd
Helpful Harry Posted July 30, 2003 Posted July 30, 2003 How do you get a layout to display only, say the 3rd feild of a repeating field. You can't. Repeating fields only display the first X number of repititions (either vertically or horizontally) via the Format > Field Format options. You basically have to use another field and set it via a script, ie. Set Field [TempField, GetRepetition (RepeatingField, RepeatNumber)] where RepeatNumber can be either a hardcoded number (eg. "3") or a Number field. I know sort of what you're going through. I did a database a while back that needed to display the availability of something for each day of the "next" two weeks. This meant setting three fields for each day: Day's Date, Day's Availability Colour, Day's Availability Code Symbol. Each of these Days was also clickable to get back to the original record (where applicable). This meant setting up 42 fields (14x3) and 14 scripts. Then the person decided to add a third week.
LiveOak Posted August 13, 2003 Posted August 13, 2003 What part of DON'T USE REPEATING FIELDS am I not successfully communicating? Use a file of regular fields as your array! Then you can have an "array" and do a calculated select: SetField(my field, Color Relationship by Number in Global Field::Color) -bd
Recommended Posts
This topic is 7876 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