December 14, 200718 yr I'm trying to create a way to import pictures of our items easily. I've got a little script setup that does this, the only problem is that I can't figure out how to add the ID of the product record that the picture belongs to. Basically, I have a Products table and a Photos table related by ProductID. My script to import the photos off the camera adds new records to the Photos table but the ProductID field in these records is blank so they don't relate back to their product record like they should. The Import dialog doesn't seem to allow access to FM variables or fields or anything like that so I can't include it in my script. Is there something I'm missing or any way I can handle this? Any information on this would be greatly appreciated. Thanks!
December 14, 200718 yr How do you tell which picture belongs to which product? Or do you always import pictures of one product at a time?
December 15, 200718 yr Author Well, there's 2 options for handling that really. First, we really will most likely be importing photos for each product as we check them in...one at a time. Another option, though, is that the Import dialog has an option to import last x number of images taken on the camera. So if you can just remember how many images of that item you just took you can add that into a popup dialog in your import photos script...how many pics did you just take...5...so it'll grab the last 5 off the camera and use them for that item. So that's where I was at when I first posted here. I do have a script that works now. It's not ideal but I think it should work ok. Basically, the script stores the ProductID in a script variable and then after importing all of the new photos into the Photos table it moves to the Photos layout and does a find for all records where ProductID is empty. Then it loops through the found set and sets ProductID to the value in the script parameter. I think this should work ok.
December 15, 200718 yr Actually, it can be even simpler, since immediately after importing a set of records, the found set *is* the imported set. Or, if you are always importing, you could define the ProductID field to auto-enter the variable.
Create an account or sign in to comment