MelJ Posted January 14, 2007 Posted January 14, 2007 I'm sure this is a "FileMaker 101" question so just call me an idiot! I'm experimenting with repeating fields and for the life of me I can't figure out how to set the next available empty repetition. My little test script just replaces the first. How do you populate a repeating field? Thanks, Mel
Søren Dyhr Posted January 15, 2007 Posted January 15, 2007 for the life of me I can't figure out how It's pretty easy, but not a required endevour ...since you by changing your approach to a more relational structure have this: http://www.filemaker.com/help/Script-Steps20.html However have Raybaudi, made the effords on your behalf: http://www.briandunning.com/cf/472 ...while I still think that you should avoid repeaters in your projects for a while learning relations instead!!!! --sd
dazlunn Posted January 15, 2007 Posted January 15, 2007 I'm assuming that you are using the 'SetField' script step here... There is more than one way to tackle this, I'm not big on repeating fields so someone else may have a much more elegant solution... Here goes.. Easy way.. When you use the SetField script step at the bottom of the dialogue box is a field that you use for the repetition. If you are populating a fixed repetition simply type in the repetition number. The not so easy way.. If you need to calculate the next repetition number then you will need a field [number] in your table, you will increment this number via your script... Field 1... Clients::NextRepetition Field 2... Clients::RepeatingField Script... SetField[Clients::NextRepetition; Clients::NextRepetition+1] SetField[Clients::RepeatingField[(Clients::NextRepetition)]; NewFieldContents] When you stipulate the Repetition number as (Clients::NextRepetition) the script simply populates the next field repetition. This method won't check that the field isempty first, so if you check out the LAST[] function in the help files you should be able to figure out a foolproofing method to prevent overwriting any existing data. Like I said earlier, it's not elegant but it does work.
comment Posted January 15, 2007 Posted January 15, 2007 I agree with Søren (I think?): if you need this, you are most likely using repeating fields where you shouldn't.
dazlunn Posted January 15, 2007 Posted January 15, 2007 Soren is dead right! The first link he has provided is exactly the way you should go and it is the method I use. Hence why I am not big on repeating fields... use of relationships should be your first priority.
MelJ Posted January 16, 2007 Author Posted January 16, 2007 Thanks so much for all the help folks! I have read MUCH about avoiding repeating fields and have done so up until this point. BUT in this particular instance the repeating field comes in VERY handy. I am scanning documents that pertain to a certain record. The user can scan up to X documents and this number will vary depending on the "Job". I couldn't see creating 10,20 or 30 fields per record for 2 scans sometimes. These fields will not be relational, searchable or anything of the like. For me (in this case) the repeating field is ideal! Thanks for all the input, Mel
Genx Posted January 16, 2007 Posted January 16, 2007 I couldn't see creating 10,20 or 30 fields per record for 2 scans sometimes. These fields will not be relational, searchable or anything of the like. For me (in this case) the repeating field is ideal! Well technically they would be related.. you can just as easily (actually more... easily) dump them into a related structure (where the related table just has two fields, key and container) rather than dealing with them in repeating fields... That way you wouldn't have to set a limit either - But up to you i suppose.
comment Posted January 16, 2007 Posted January 16, 2007 I agree with Genx: this is a classic case for related records. Just consider what would happen when a document is deleted.
Recommended Posts
This topic is 6523 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