broberts7usa Posted May 7, 2003 Posted May 7, 2003 I have a portal in one file which displays photos (in another file) for the record, also whether or not they are the "default" photo - in the images file (where they are added) there is a "default" (Y/N) field to select the default photo. How can I make sure that (in the images file) the default field can be "Yes" for only one photo for the (related) record in the main file? I would like to add a button beside the portal in the main file which says "select as default" ... I know I need a script to go through the related images for that record and change the default field for that image to yes and all the others in the portal to No ... need some global fields somewhere (in both files?) ...it's hurting my head ... any suggestions?
Paolo Posted May 7, 2003 Posted May 7, 2003 There are a lot of ways to do that. I suggest you this one: instead of a flag in the related file that tells if the photo is default or not use a record in the main file that tells what photo is the deafult one. let's call the main file A and the related file B 1) define a field in A called default_photo_rec_id 2) define a calculation field in B called photo_rec_id as Status(CurrentRecordID) 3) you alredy have a relationship from A to B (let's call it RB). You alredy use this relationship to show the photos in the portal. 4) define the same relationship (3) in B linking the same fields from B to A. Call it RA 5) define a calculation field in B called is_default as if( RA::default_photo_rec = photo_rec_id; "Yes"; "No" ) 6) put the related field RB::is_default in the portal in A to tell the user if the photo is the default one or not. 7) In A define a script called SetAsDefault as SetField( default_photo_rec_id, RB::photo_rec_id ) Enter Preview Mode[] Enter Browse Mode[] (the steps 2 and 3 are needed to update the portal after the script changhes the default photo) 8) Put a button in the portal in A that performs SetAsDefault. This button sets the selected photo as the default one. Good luck!!
broberts7usa Posted May 7, 2003 Author Posted May 7, 2003 Ciao Paolo, mi mancha Italia - This looks perfetto. I already have many of the fields because I knew I needed them, but I am such a newbie I couldn't figure out how to use them. Question: in the last step, would "refresh window" work as well as changing modes? Grazie, I will let you know come si funziona - Bonnie
Ugo DI LUCA Posted May 7, 2003 Posted May 7, 2003 Hi Paolo, As there is a relationship here, I'll only play with it using a renumbering of related records. Therefore, you'll be moving the related records up or down to find out which is the photo record that should become N
broberts7usa Posted May 7, 2003 Author Posted May 7, 2003 Ciao Ugo, Non sono un newbie con italiano ma ovviamente ho bisogno di prattica (it's been 2 years since I was there - manca/mancha is a newbie error!!! oops) I did not understand what you wrote to Paolo about renumbering the related fields - the image IDs are created when the photo is added to the images file - : I am still in the middle of fixing everything, will report back se funziona - Bonnie
Ugo DI LUCA Posted May 7, 2003 Posted May 7, 2003 Hi, Better than a flag in the related file, you could use a renumbering portal technique. See DJ's sample in the sample section, as it will become clearer. I use it for almost all my default settings (i.e. adress for contacts with a adress db related to a contact db). It's smooth. The advantage of such a technique is that if you were (for other reasons) using this default, as you renumber this record to be the first related record (it could have been N
Paolo Posted May 7, 2003 Posted May 7, 2003 Question: in the last step, would "refresh window" work as well as changing modes? No, it would not!! (Don't ask me why )
broberts7usa Posted May 7, 2003 Author Posted May 7, 2003 OK, it's not working. I can't change the images to default in file A and have it change in file B, either by changing it manually or through the button script, also I can't get it to display the default image - Can someone take a look and tell me why? (this is obviously the first DB I've ever created) I'd rather email it than attach it ...
broberts7usa Posted May 7, 2003 Author Posted May 7, 2003 Help!! I've figured out part of the reason this isn't working (the calculated fields Paolo suggested do not allow modification in either file) but now I am thoroughly confused, I have changed things around but do not understand why the rlnshps do not work. I am going to start a new thread called "set as default" button and explain all the fields and rlnshps and hopefully someone can tell me what is wrong with it all. Bonnie
Recommended Posts
This topic is 7874 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