July 21, 200619 yr I have two tables: Products and Photos. Each Product has a unique ProdID, and each related picture has a ProdID for its corresponding product. ProdID is, obviously, the match key. Here's the question: On a product page, I would like to show the first picture from the related Photos table in a small window. Next to the picture, I would like to supply forward and backward buttons to thumb through each related picture in the Photos table. How can this be done? It seems portal-ish, but I'm not sure how I'd get the single-row portal to thumb through the related pictures. Furthermore, I'd like to supply a check box next to the pictures window that allows me to choose which picture is the "default" that should show up when I come back to this product page. Any ideas on how to go about this?
July 21, 200619 yr I had to do this a while back. I solved the problem by giving each image i added an increasing ID number - the basic concept is to use the max function in the parent table - anyway, have a search on the forums and you'll find plenty on it. In the mean time, then you just use add a second relationship string between a number field in your parent table (that stores the "id" of the image you are wanting to view) and your "id" field in your image table. I.e. Primary Table <-> Image Table ProdID = ProdForeign CurImg = ImageID Anyway... generating the image id aside, you could then by default set your CurImg field to be 1 - thereby give you your "default" first entered image. Then to browse through you could just increment the serial - though it doesn't counter against deleted images. My way was a bit simpler - i only allowed for storage of 8 images and generated empty shell records with text based id's when creating a new record.
July 21, 200619 yr Since you have version 8, you can use the GetNthRecord() function for this. I see you posted this in Value Lists, and that's what you would use in previous versions. No matter which method you use, the last selected picture will be there when you come back to the record. Navigating to another record does not change fields' contents - unless you script this. Edited July 21, 200619 yr by Guest
July 24, 200619 yr Author GetNthRecord works perfectly. Thank you! There's only 1 downside I see: this method copies my photo from the Pictures table to the Products table, which will greatly increase the size of my database since we have lots of photos. Is there a way to accomplish this so that I can view the photo(s) in the Pictures table from the Products record without actually copying it to my Products record?
Create an account or sign in to comment