ranger29 Posted March 16, 2013 Posted March 16, 2013 I think this should be a simple calculation, but I can't get it to work. For field3, I need to copy the value from field1 if the value in field2 is 1. Details: I have a time series table, each record is a year (field is [year], values are 1972, 1973, 1974, etc.). This is a country's timeline, during which some years it is at peace. I have a field [firstyearpeace] that is a number field with values of either 1 or [blank]. If it is a 1, that means that year is the first year of an era of peace. I have another number field [peacestartcalyr] that I want to be the calendar year of the first era of peace. I think this should be an If.. Then calculation (or perhaps a Case calculation? I'm using 12 Pro Advanced). In the calculation formula for [peacestartcalyr] I have:If ( firstyearpeace = 1 ; GetField ( year ) ; ) When I click "OK", nothing happens. I already have the [firstyearpeace] and [year] fields populated. What am I doing wrong? Syntax? Should I be using Case? If so, what syntax for that? I don't get an error when I hit OK from the Specify Calculation dialog box. If the value in the [firstyearpeace] is blank, I want it to leave [peacestartcalyr] blank.
ranger29 Posted March 17, 2013 Author Posted March 17, 2013 Thank you so much Bruce. At first I couldn't get it to work, then I remembered some (all?) calculations are only performed after something is freshly entered in a field (in this case, entering "1" in [firstyearpeace]. In my situation the appropriate [firstyearpeace] fields were already populated with 1s, which is why it didn't work the first time. My workaround: I did a Find for all those with a 1, removed it via Replace Field Contents, put the 1 back, Replaced Field Contents again, and then all my peacestartcalyer fields happily populated with the correct year. Is there a setting somewhere to make the calculation happen automatically when fields are already populated - something like "Relookup Field Contents" for Calculations?
bruceR Posted March 17, 2013 Posted March 17, 2013 You're leaving something out. None of that should be necessary. Did you define the field as a calculation field or as an auto-enter calc. Sounds like you defined it as an auto-enter calc. It would be good to post a copy of your file, or a clone, or simplified example.
Aussie John Posted March 22, 2013 Posted March 22, 2013 Might be a "storage options" thing if it is a calculation - change to - do not store - will give you instant refresh
Recommended Posts
This topic is 4603 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