In article <1170715955.613858.293620 (AT) h3g2000cwc (DOT) googlegroups.com>,
"garthwaitenator (AT) gmail (DOT) com" <garthwaitenator (AT) gmail (DOT) com> wrote:
Quote:
i'm fairly new to FMP. so first let me apologize if i don't get the
terminology correct.
i've created a button that inserts a file into a field. or i should
say references a file. this field has 10 repetitions. when i want to
add more than one file, how can i assign the button to add the new
file to the next open repetition? at the moment, it keeps replacing
the original file. |
If you want to continue using a repeating field, then it can be done in
three ways.
A. You can simply click in the repetition you want and have the
button simply perform an Import command.
B. You can have a separate Import button for each repetition that
perform a script along the lines of:
Go To Field [RepeatingField, -X]
Insert Picture []
where X is the required repetition for each button (you set
that at the bottom of the 'Choose a field' window)
C. You can have one Import button that works out which repetition
to use by checking each one with an If statement. Something like:
If [IsEmpty(GetRepetition(RepeatingField, 10)]
Go To Field [RepeatingField, -10]
End If
If [IsEmpty(GetRepetition(RepeatingField, 9)]
Go To Field [RepeatingField, -9]
End If
...
If [IsEmpty(GetRepetition(RepeatingField, 2)]
Go To Field [RepeatingField, -2]
End If
If [IsEmpty(GetRepetition(RepeatingField, 1)]
Go To Field [RepeatingField, -1]
End If
Insert Picture []
Having the If statements work backwards through the repetitions
means that when you reach the Insert Picture command FileMaker
will be waiting in the last empty repetition.
If that blinks the screen to much, then you could try putting a
Freeze Window command at the start of the script. Or you can
move the Insert Picture command inside EACH If statement
follwed by an Exit Script command ... but you'll also need to
reverse the order of the If staments in this case.
BUT
You might be better changing your database to use a Relationship to a
separate table / file that stores just the images. Then you can simply
impot to a new record, setting the relationship data as needed so the
main record's portal displays it. This way means you can have more than
10 images without needing to worry about changing anything in the
database (other than perhaps adding a scrollbar to the portal)
Helpful Harry
Hopefully helping harassed humans happily handle handiwork hardships ;o)