Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

How to include ID of related record in new imported records..??


This topic is 6188 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

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!

Posted

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.

Posted

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.

This topic is 6188 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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.