broberts7usa Posted May 15, 2003 Posted May 15, 2003 Hi all, thanks to Russ (and Ugo, and Peter, and ... ) my default image portal is working just perfectly - all the images for a property can be seen in one place and I can make any image the default for that property. Now, I want to be able to add images (to the images DB) from a button near (or in??) the portal in the properties DB --- but as usual I am confused --- The script I am working on looks like this so far: GTRR (Images) Perform external script (the AddImage script in Images) (are these 2 things backwards?) the external script: Go to Layout [Admin] Set field[g_LastRecord, PropertyID] ?Copy[g_LastRecord] New Record/Request Paste[PropertyID] Go to Field[image] Insert Picture[] Go to Field [imageNumber] etc. Now I reach the limits of my newbie knowledge. How do I get back to the Properties DB so I can see the new image in the portal? I know this is probably very easy and I will be embarrassed when you guys clue me in. I am sorry to be such hard work but you guys are such good teachers! Thanks - Bonnie
Peter Fenner Posted May 15, 2003 Posted May 15, 2003 Hi Bonnie Your Relationship between properties and images must be set to "allow creation of related records" The script is: Go to Portal Row (last) Go to Field [Your Image Field} Insert Picture[] Exit Record/Request The button does not sit on the portal. Next to it. You never leave the same screen. Pete
broberts7usa Posted May 15, 2003 Author Posted May 15, 2003 BUT - BUT - there are lots of things that need to be filled out in the ImagesDB (required things) - and I don't want to insert a picture, only a reference to one (they sit in another folder) - and I don't want anyone to be able to create new properties from the ImagesDM (this may not be relevant though) - Still befuddled (my usual state) - Bonnie
Peter Fenner Posted May 15, 2003 Posted May 15, 2003 OK, I Get It. There are several ways. I would do the following: In your properties database create a new layout called: "Add Image Layout". Still make your relationship: "allow creation of related records". Script: Go to Portal Row (last) Go to Field [Your Image Field] Allow User Abort [Off] Insert Picture[] SetField [gShowImage, ImageID} Go to Layout[AddImageLayout] That's the script. On the add image layout you will place the related fields (based on a new relationship gShowImage::ImageID) that require entry. The pic will be there from the above script. (include a "change pic" script which is straightforward) Have a "Done" button which confirms all entries are made and a "Cancel" button that deletes this related record and goes back to image portal screen. Remember: no fields allow entry in the portal. Users won't be able to create a new record anyway. Pete
Peter Fenner Posted May 15, 2003 Posted May 15, 2003 The users will have to tick the box "store only a reference to this file" - I don't know how you can overcome this "error-prone" user interaction. Pete
SteveB Posted May 15, 2003 Posted May 15, 2003 Use the Troi file plugin, since storing the reference can be scripted. www.troi.com Steve
broberts7usa Posted May 15, 2003 Author Posted May 15, 2003 I have this plug-in but have not yet used it (or learned how to). How do I make it work in this case? (i seem to only learn things as i need them but that's what happens under deadline ...) Peter's solution works nicely - but isn't it true I can even do it on the same "Select Default Image" layout without having to change layouts and without the "done" button (I think) if I make the fields require validation? right?
Peter Fenner Posted May 15, 2003 Posted May 15, 2003 No, the new record fields are based on the gShowImage::ImageID relationship. When a user views the image portal they will have this data next to it. If there is no data they could try to enter data with no joy (as the relationship is not defined, ie: no entry in gShowImage). If there is data it could be for a completely unrelated property. Pete
broberts7usa Posted May 15, 2003 Author Posted May 15, 2003 I take it back, this does NOT work - it does not retain the image file name or the image number or description (all required fields - but I haven't required validation yet) when changing to another record and back. I haven't figured out exactly what it's doing but it's changing to the info for another image as I switch back and forth between records. Also, it renamed one of the other photos. I think I have to have a create new record (in Images) in there somewhere. That's why I started all this with a script using an external script, see above, when I started. Help?
Peter Fenner Posted May 15, 2003 Posted May 15, 2003 Bonnie, since you probably have the troi dialogue buttons (I don't). Your best solution, assuming there are not too many fields (relating to the new image) that require entry, would be to present the users with the following sequence: They click the add photo button A dialogue box asks them to select the photo from hard drive. They do this and click continue. Another dialogue box asks for the description of the image. They input this and click continue. They are taken back to the portal image layout in Properties (which they never left anyway) Tip: Research your Troi plug-in. Pete
Peter Fenner Posted May 15, 2003 Posted May 15, 2003 Have you set your relationship to: "allow creation of related records"? It will work. BTW, If you switch between records in the properties database the same information will be showing on every record. The user can only get to this layout via the script which sets the gShowImage field appropriately. It is 100% safe. Pete
Peter Fenner Posted May 15, 2003 Posted May 15, 2003 I am assuming your ImageID is a serial number. Looking at the copy of your database I have it is not. Surely you want this to be a serial number? It would need to be for my methodolgy to work. Pete
broberts7usa Posted May 15, 2003 Author Posted May 15, 2003 OK, it works now. Why it wasn't working: I have 2 relationships with Images and I was using the wrong one. Why it was changing other image records: the tab order in the layout was going to the portal (still on the page because I just duplicated the default image layout) combined with my typing speed (I never thought it was that fast, but apparently too fast for this ...) I did all this on a duplicate layout, and now I think I'll change the script to have everything take place on the default photo layout - no need to have a new one. Also will try a few other ways to make sure the fields for the new image record get filled out correctly - dialogs? validation? something will work - and look into the plug-in so it can store the reference automatically and it would be nice if it automatically put the filename in the image filename field ... Thanks guys!
broberts7usa Posted May 15, 2003 Author Posted May 15, 2003 I've added a serial # ImageID field since you saw it last (I finally noticed it was missing). Why is that why it's working, though?
Peter Fenner Posted May 15, 2003 Posted May 15, 2003 I think you are testing the database with the same image? I assume your newly added field is the ImageID field I refer to. Pete
broberts7usa Posted May 15, 2003 Author Posted May 15, 2003 No. I'm testing it by adding bogus images. I'll delete them and fix the serial numbers. Everything's working. The 4 required fields in Images are (not in this order) ImageID, ImageNumber (ie. 3 if it's the 3rd pic for the bldg), ImageDescription, and ImageFilename. All is well ...
Peter Fenner Posted May 15, 2003 Posted May 15, 2003 Confirmation of all above: Fields Required (for script) In Properties Database: PropertyID (Serial Nr) gShowImage (Global Field) Layouts Required (for script) in Properties Database: L1: Layout showing Portal with all Images for Property L2: Entry Layout: Add New Image Layout (Cannot Exit unless process is complete) Fields Required in Images Database: ImageID (SerialNr) ImageField (Container) You will need the following relationships from Property DB to Images DB R1: PropertyID::PropertyID (allow creation) R2: gShowImage::ImageID (need not be allow creation) The script (Which is launched from L1) Go to Portal Row (last) Go to Field [imageField] Allow User Abort [Off] Insert Picture[] SetField [gShowImage, ImageID} Go to Layout[L2] Now you are on L2: Add New Image Layout The fields you have here are: General fields related to the Property (ie: address, etc.) And fields based on the R2 relationship are shown on this layout, such as: ::ImageField ::ImageDescription etc.. There would also be 3 buttons on this layout (BTW, this layout can also be used as Edit Image Data as opposed to Add Image Data) The buttons are: Update Picture - Simply changes the picture reference with a simple script. Done - which verifies all the data has been entered as is reuired Cancel - Deletes the related record (gShowImage::ImageID) and goes to L1 layout. Pete
Recommended Posts
This topic is 7866 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 accountSign in
Already have an account? Sign in here.
Sign In Now