Yeti Posted February 7, 2001 Posted February 7, 2001 Is it possible to make a new record in a second file and at the same time insert data from the first file? I expect to get into trouble 'cause there's no ID-number for the first file to relate to. Then the logical thing to do is to use the Set Field command to cover this. Can anyone tell me whether this is possible? ------------------ Yeti
LiveOak Posted February 7, 2001 Posted February 7, 2001 Just script the operation. Create a new record in the second file and use globals, a constant relationship, and set field functions to fill out the data. For that matter, you an set the key field and drive lookups for the rest. -bd [This message has been edited by LiveOak (edited February 07, 2001).]
Yeti Posted February 9, 2001 Author Posted February 9, 2001 Hey, that's weird. I thought I replied to myself telling that I solved the problem. With the Set Field Command: Set Field ["projects::companyname";"companyname"] Now I found out that a new record will only be made when there isn't another with the same related data (ID-number). Let me explain: we want to be able to search for a record in the Adressfile and transport certain data to the Projectsfile. This works fine for the first time, but what if a new order is granted to us by the same person and I wanted to make a new Projectsrecord? FM will see that there's allready a record there containing the same ID-number so I won't be able to make a new record in the related file for the second time. Or is there a way to work around this? Can anyone tell me how to establish this? TIA ------------------ Yeti
Yeti Posted February 9, 2001 Author Posted February 9, 2001 Live Oak, thanks for your reply. What do you mean by use globals? A Global contains the same for every record in a file, doesn't it? So why could this be helpful for me? In other words: could you please specify your answer? TIA ------------------ Yeti
LiveOak Posted February 9, 2001 Posted February 9, 2001 That's correct. Globals can be used as temporary containers for data to be passed to another file. If you create fields defined as: Constant (calculation, number, indexed) = 1 in both files and create a relationship based upon Constant <--> Constant (call it ConstRel), globals can be used to pass data. For instance: In file 1: Set Field (globalOne, Name) Set Field (globalTwo, Address) In file 2: New Record/Request/Page Set Field (Name2, ConstRel::globalOne) Set Field (Address2, ConstRel::globalTwo) -bd
Yeti Posted February 9, 2001 Author Posted February 9, 2001 I'm sorry, but I get really lost here.... Do you mean that I have to create three files two accomplish my task? As in: one Adressfile one Globalfields-file and one Projectsfile Relate them together and: Presto? Or do you mean that I have to set every field in the Projectsfile to being a global. Or...or....I'm so sorry for not grasping what you're saying, but could you explain it to me one more time? Maybe in Sesamestreet-language? ------------------ Yeti
LiveOak Posted February 9, 2001 Posted February 9, 2001 The fields globalOne and globalTwo are fields in file 1. The constant relationship is really invalid for real data in records since all records in file 1 relate to all records in file 2. It usefulness is to allow access to global fields (which exist once per file, not once per record) created in file 1 from file 2. Global fields are like data buckets. Walk over to file 1, dump data into global buckets (say 2 buckets in my example), walk over to file 2, create a new record, reach back to file 1 and pickup your data buckets (access the globals), and dump the first bucket into the Name field in file 2, and dump the second bucket into the address field in file 2. You could jump back and forth using copy and paste (using the clipboard as a bucket), but sometimes other programs change the clipboard. -bd
Yeti Posted February 12, 2001 Author Posted February 12, 2001 That makes things a lot clearer.I'll go play around with this to make it work. Thanks for yor reply and patience, LiveOak
Yeti Posted February 12, 2001 Author Posted February 12, 2001 It works! Partly.... I followed your guidelines by the letter and I understand what I'm doing, which is more than I could say last week! But (there's allways a but) I only get the data from the first record from my adressfile to show up in the projectsfile. I used the Omit Scriptsteps to filter out the record I want to "transport", but still only the first records data goes to Projects. This would make sense without Omit 'cause FM allways gets the first record in line. What do I do now. I know of no other scriptstep than Omit to filter out a record. It allways works, so why doesn't is now..... ------------------ Yeti
LiveOak Posted February 12, 2001 Posted February 12, 2001 I think it's time you step back and tell us what the overall effect you are trying to accomplish is. I'll bet there is a much easier solutions. -bd
Yeti Posted February 13, 2001 Author Posted February 13, 2001 Dear LiveOak, it helps me a lot to know that there are tutors I can turn to when I'm at a loss. The good news is that I solved what I was trying to accomplish, using your advice and explanations. Thanx a million! ------------------ Yeti
Recommended Posts
This topic is 8689 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