dbfreak Posted July 11, 2008 Posted July 11, 2008 Hey all! So Ive been trying to revamp / rebuild a new database and this time I am using separate files to store different information. Most of the things I have learned are self taught by trial and error and I have recently gone over some online tutorials and have a fmpro9 book. I dont really know what to call what it is i am trying to do so im kind of stuck... What I am putting together is a road manager system. Ive got a bulk of this put together with the new things i have learned but here is where i am stuck: Id like to create a new record (show advance) which auto enters a new show id but when i do, Id like to also create a new settlement record (settlement) for that day that would also auto enter the show id. I have made a script that will create both records with one button click but the settlement record does not auto enter the show id to link them together. I have a _kp_show_id field on my main page(show advance) and a _kf_show_id on my settlement (settlement) page. is there anyway to have the show id field auto enter upon creation of a new record in both(show advance)and(settlement)? Initially i inserted a drop down look up where the date field in the settlement file sees a list of files in show advance. Which when I select one of those dates will auto enter all the information ive requested it to do but I would like to take that step out. I hope this makes some sense. It does in my head but I have a very basic knowledge of what is going on here.
mr_vodka Posted July 11, 2008 Posted July 11, 2008 If they are related, you can turn on Allow creation of Record on the settlement side of the relationship. Then a simple set field step with the date should create the related record for you. The button to create the new record could be like this. New Record/Request Set Field [settlement::Date; Get (CurrentDate) ] Commit Record []
dbfreak Posted July 11, 2008 Author Posted July 11, 2008 Thanks for the reply and the help mr V. I tried turning on allow creation of record on the settlement side. I show a relationship on both the show advance file and the settlement file if i look at them individually. I think that is correctly done. I tried it on the settlement side of the relationship then the show advance side and both with no luck. I went to try the button and stopped because: I dont have current dates set up. The second step for me is to input the date of the show information. Would it be best to insert a current date field and link it there? or can I script the button to find the show id and have that be the set field? I looked my self but when i did a set field the show id didnt show up as an option.
dbfreak Posted July 11, 2008 Author Posted July 11, 2008 i went back and tried again and i found the show id in a different spot than i suspected. here is what i did for the button: new record/request perform script ["new record" from file: "settlement"] set field [settlement:_kf_show_id;show advance::_kp_show_id = settlement::_kf_show_id] commit records/requests[] that worked to open the 2 files and have them show the same "show id" but I bet I have too much of something there dont i? Also: if im doing it this way is it safe to say that upon creation of a new record i will only get both records to share the show id and once i enter the data in the show advance record i will still have to use the drop down to search for the auto enter information on the settlement side? or would it be smarter to create a button to create a record like that after i have input the necessary data which should pull up all the auto enter data im looking for? I do apologize for my lack of knowledge. I also know that I am doing a horrible job at describing what it is i am after. I guess the best bit of information you could give is: is that script going to screw me up in the future? Thanks again for your help!
Tim W Posted July 11, 2008 Posted July 11, 2008 Hi, The best thing for you to do is attach a zipped copy of your file(s). A picture is worth a thousand or so words and can describe what you are trying to do better than a entire book. If your file is large, then go to file>save copy as>clone and attach the clone so we can have a look. The clone strips out data records. Thanks, Tim
mr_vodka Posted July 12, 2008 Posted July 12, 2008 here is what i did for the button: new record/request perform script ["new record" from file: "settlement"] set field [settlement:_kf_show_id;show advance::_kp_show_id = settlement::_kf_show_id] commit records/requests[] You do not need to perform a script for the other file if you do not wish. If you add a file reference to the other file you can then create a table occurrence of the table from file2. Then you can just use it much like a local table. A simple set field like I stated earlier will do it. If you do not want to do it this way and you want to open up the other file, you can call the external file script and pass the ID as a script parameter.
dbfreak Posted July 29, 2008 Author Posted July 29, 2008 I used what you suggested and found that making a button was easier as when i create a new record i dont use auto-enter dates due to inputing data in advance. So i created this button and it works great but i hit it a second time and it wiped out the information that was auto entered in the requested record. Now I wonder if there is a way to make the button work only once. I found a selection for the repitition of, in the button preferences but that didnt seem to stop it. Is this something that will always happen as i come and go to different records?
Recommended Posts
This topic is 5962 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