Forum Joe Posted June 29, 2007 Posted June 29, 2007 I need some help with a text field. I've got the following set up. textField1 is a field that can only have values from a value list, and no others. textField2 is a field that is set to "Auto-Enter Calculation" and the calculation references only textField1. It's like a Case statement, but also with some other complexities. The details aren't relevant here. However, what is important is that this field IS editable. If the user doesn't like what is in there, they can change it. Now, what I want is sort of half-and-half of the "do not replace existing value of the field, if any" property. If the user has not manually entered anything into textfield2, then it will be the 'default' value for the value of textfield1. Assuming the "Do not replace" property is not set, then changing field1 will change field2. I want this to happen, BUT ONLY IF THE USER HAS NOT ENTERED CUSTOM DATA INTO FIELD 2. If the user has entered their own value into field2, I want it to be remembered, and for the value not to change if field1 does. On the other hand, if the user has not manually entered data, then it should update when the value of textfield1 changes. Does this make sense? Is it possible?
Ugo DI LUCA Posted June 29, 2007 Posted June 29, 2007 It's a bit of a gymnastic session with FileMaker engine and evaluations, but you may give this a try. Assuming data entries aren't made through a script. One extra auto-entered number field _userModifiedField2 with calculation set to Case ( field1 And Get ( ActiveFieldName ) = "field1" ; Case ( _userModifiedFied2 = 1 ; 1 ; 0 ) ; Get ( ActiveFieldName ) = "field2" And Not IsEmpty ( field2 ) ; 1 ) then field2 could have a calculation of Case ( Get ( ActiveFieldName ) = "field2" ; field2 ; Case ( field1 And Not _userModifiedFied2 ; field1 ; field2 ) ) Both field with auto-enter option to recalculate if needed Now, if I understood, the first value entered manually will be kept whatever the changes in field1, unless you manually or ( by script ) reset the value of _userModifierField2 HTH ( and hope it works )
LaRetta Posted June 29, 2007 Posted June 29, 2007 Hi Ugo! It's great to see you around so I can pick on you again! field1 And Not _userModifiedFied2 Whether it works or not, I can't currently test. But you are using text fields as boolean for field1 AND _userModifiedField2? If they don't have numbers in them, it won't work, will it?
Ugo DI LUCA Posted June 29, 2007 Posted June 29, 2007 I didn't tried it myself ( just pulled the calcs in the data viewer ) True it can be a problem, but actually it would if field1 was equal to 1 in field1 I think, as then the Case ( Field1 etc. ) will become true. No matter if these are text field, Case ( MyField ; etc ) is just here to evaluate any change in that 'MyField' But _userModifiedField2 is a number field. Again, not seriously tested it, but thanks for picking me, you missed me :P
comment Posted June 29, 2007 Posted June 29, 2007 I would let go of auto-enters entirely and have an override field for a calculation field = Case ( IsEmpty ( OverrideField ) ; ; OverrideField ) With the auto-enters, there's always room for some unforeseen chain of events that will not produce the intended result.
Ugo DI LUCA Posted June 29, 2007 Posted June 29, 2007 Yep, I agree with Comment... Me too, Vaughan. Probably playing too hard with FileMaker evaluation process here.
Recommended Posts
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