The Mad Jammer Posted January 14, 2005 Posted January 14, 2005 Is there a way to import one file and have it write records to multiple files. I have an old flat file I'm converting that contains item information along with master information on the same record I.e. all of the costs and charges are the on the record along with customer info, shipping data etc...). I'm going to create relational data from this one import file. What I want to do os import the file and have it automatically create child records on the related files. For insatnce, I want to import the data and create the Master record and then have the import populate the cost file and the charges file at the same time. How would I set the value of the of the related fields to the imported fields? Thanks The Mad Jammer
transpower Posted January 14, 2005 Posted January 14, 2005 Script it: import to one file, then use the script to post to the other files.
The Mad Jammer Posted January 18, 2005 Author Posted January 18, 2005 That's what I thought. Thanks Jammer
BobWeaver Posted January 20, 2005 Posted January 20, 2005 You can also just import into the parent file the parent field data and delete duplicate records. Then import again into the child file(s) the child field data. Make sure you import the key field into both parent and child files so you have something to relate the files with.
The Mad Jammer Posted February 9, 2005 Author Posted February 9, 2005 I tried the scripting Transpower described but it didn't work. I imported all the data into a master file and defined a relationship with a child file based on the record number of the master file. I also defined a relationship in the child file back to the master file using the master record number. I then wrote a script in the master file that tests the field(s) I want to populate my child file with and if there is anything in the field, execute a script on the child file that creates a new record and populates the fields. The problem is that the fields weren't populated on the child file. Here is the script on the master file If isEmpty("Cost1") Exit Script End If Perform Script[sub-scripts, External:"cost.fp5"] In the child file I have the called script New Record/Request Set Field ["rel_Rec_Num", "master::Rec_Num] Set Field ["Cost_Type", "Cost 1"] Set Field ["Cost_Amt", "master::Cost1"] Needless to say, a record was created but the only field that was populated was the Cost_type field because it was hard coded text. Why didn't the other two fields get populated? The Mad Jammer
-Queue- Posted February 9, 2005 Posted February 9, 2005 The other fields did not populate because you are referencing a relationship that does not yet exist between this record and the master file. Therefore, unless the fields are globals, related data cannot be passed. Instead, try If [isEmpty(Cost1)] Exit Script End If Set Field [global_Rec_Num, Rec_Num] Perform Script [External: "cost.fp5"] New Record/Request Set Field [rel_Rec_Num, master::global_Rec_Num] <- globals can be passed using even currently invalid relationships Set Field [Cost_Type, "Cost 1"] Set Field [Cost_Amt, master::Cost1] <- should work now, because the relationship was established when rel_Rec_Num was set with the global
The Mad Jammer Posted February 9, 2005 Author Posted February 9, 2005 I figured that was the reason but didn't know how to get the relationship established. I'll give this whirl and let you know how it turns out. The Mad Jammer
The Mad Jammer Posted February 9, 2005 Author Posted February 9, 2005 --Queue-- That worked perfectly. Thanks for the help. Let me buy you a beer! The Mad Jammer
Recommended Posts
This topic is 7227 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