YuChieh Posted October 24, 2005 Posted October 24, 2005 hi, I have 2 fileds in the same database. Field1 is a calculation field. I would like to auto-enter the value from Field1 into Field2. I tried 2 different ways -- 1. in Define Fields, Field2, Options, Auto-Enter, Check “Calculated Value” box, put “Field1” in the calculation area. 2. I set up a relationship from the database to the database itself (linked by the unique field) in Define Fields, Field2, Options, Auto-Enter, Check “Looked-up value” box, select the relationship, then select Field1. neither works. Can anybody help?
Lee Smith Posted October 24, 2005 Posted October 24, 2005 If I'm understanding you correctly, it sounds like you are asking FM to populate a field based on a field that is blank at the time the record is being created. I.e., Since Auto Enter only works when a new Record is created, isn't the field blank at that point? You could make the second field a calculation the is = to the other field, Or, use a script to populate the second field as part of a script using set field, insert calculated result, etc. HTH Lee
PeterHW Posted October 24, 2005 Posted October 24, 2005 Hi YuChieh, both auto-enter calculations and look-ups are 'passive', i.e. they will not update until one of the fields or relationships they rely on changes. So if you have created Field2 some time after Field1, Filemaker will not automatically update all records for you. I assume the behaviour you expect / desire is that field2 will have the same content as field1 for all records in your database ? In principal both your approaches were correct, but you incorrectly assumed Field2 would automatically update. In stead, you need to use the "Relookup contents" command from the Records menu. Place your cursor inside Field1 (for your first approach) or UniqueID (your second approach) and activate this command. FM will ask for confirmation. If you are not sure you want to do this for all your records, first make sure you have a limited found set of records (the relookup will only be performed for the currently found set). HTH, Peter
YuChieh Posted October 24, 2005 Author Posted October 24, 2005 Thanks both for the reply. I didn't know auto-enter only works when a new record is created. In this case, my approches won't work. I cannot make Field2 a calculation field either because I want the ability to change the value in Field2. If I use script to set field and insert calculated result all that, is there a way that the script can automatically run when the database is open? I am not sure I can use "Relookup contents" command from the Records menu method. Because this is an open form to our users and they need to see the value there right away without clicking on anything. Thanks for the help.
Lee Smith Posted October 24, 2005 Posted October 24, 2005 Instead of telling us how you are trying to change the field, tell us why you are trying to change it. What do you have now, and what do you want to be your end result? HTH Lee
YuChieh Posted October 24, 2005 Author Posted October 24, 2005 What I have now - * Field1 is a calculation filed. * using auto-enter to populate Field1 value into Field2. but not working since both fields are blank when the record is created. What I want - auto populate Field2 = value of Field1 and Field2 can be modified Thanks
Raybaudi Posted October 24, 2005 Posted October 24, 2005 Hi for what you want, you have to make the BIG JUMP ! If you'll buy FMP8 (or even 7), you'll resolve your problem !
YuChieh Posted October 24, 2005 Author Posted October 24, 2005 Yes, I do see there are quite a few neat features in versoion 7 and 8. Unfortunately, upgrading is out of the question for us right now. So I will have to work with what I have.
SlimJim Posted October 24, 2005 Posted October 24, 2005 I think you are left with the scripted solution. You can run this as part of your start-up script but it could take a while, depending on how many records you have. I think the quickest solution - but if I'm wrong someone please correct me - is to find All and then Replace Contents Field2 by Calculation (= Field1)
YuChieh Posted October 24, 2005 Author Posted October 24, 2005 That's what I was guessing as well - using script. How do I setup "start-up" script, I always wonder? Is there a way to setup a script that can automatically run without clicking on the button? Thanks
Lee Smith Posted October 24, 2005 Posted October 24, 2005 Yes, in either a startup or closing script. Create a script that sets the field the way you want, and then select it as your start/or closing script. You do this in the Preferences under [color:blue] Main Menu >> Preferences >> Document choose the action you want and then select the script your script would look something like this: Go to Record/Request/Page [ First ] Loop Set Field [ Field 2, Field 1 ] Go to Record/Request/Page [ Next, Exit after last ] End Loop This will work only on a found set of records. It might be something that you would want to do when closing the file instead, and as a part of your script isolate those records to be change if it is anything other than all. HTH Lee
Recommended Posts
This topic is 7036 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