I have a database where each record in a given table could have a variable number of images associated with it (0 to 4), and I'm trying to plan out the schema and how to build one of the layouts. My first instinct is to keep the container field in a separate table related to the first. That's all well and good from a data normalization perspective, but where I'm unable to come up with an elegant solution is how to show the variable numbers of images on a layout.
One thought was to have a repeating container field and use a slide control, with one repetition per pane in the slide control. This seems somewhat tedious, since I don't see a way to use a calculation to denote which repetition should appear on which "panel" of the slide control. I'm also just not a huge fan of repeating fields. This also leaves me with the problem of having "empty" panels in the slide control for records that do not have the maximum number of images. One thought was to have a number of stacked slide controls and set the visibility on each one to be visible only if the number of images equals the number of panels in that slide control. Basically, if a record had two images, only the slide control with 2 panels would be visible. The slide controls with 3 or 4 images (and the container that would need to be included for cases of only a single image) would be invisible. If I use a repeating container field to store the images, this would depend on the images being stored in consecutive repetitions with no "gaps". I can live with that if I have to, but it just seems the wrong way to do things.
If I use a related table with a non-repeating container field, I'm not sure how I can make the slide control work since I'd have to show the container from a related record, with the first related record in the first panel, the second in the second panel, etc. I know how to get the *count* of related records, just not how to display the 1st in the 1st panel, 2nd in the 2nd panel, etc.
I'm still fleshing this particular database out, but I'm likely to have a similar need for text as I do for images (multiple text fields related to a given parent record).
So, is there a better way to handle this that I'm not thinking of?