lsmall Posted November 26, 2008 Share Posted November 26, 2008 I am trying to come up with a calculation to incorporate into a script. Basically the calculation has to compare the value of a field in the current record against the value of the same field in the previous record. It seems like there should be a fairly straight forward way to do this, but I'm missing it. It would be a boolean result. The value is either equal or notequal to the previous value. Would appreciate some help. Thanks. Link to comment Share on other sites More sharing options...
bcooney Posted November 26, 2008 Share Posted November 26, 2008 How would you define the previous record? (It changes based on sort order and found set). In the same table or that last one viewed? You could capture a value in a variable in a navigation script, compare and set a field. Can you expand on your goal? Link to comment Share on other sites More sharing options...
comment Posted November 26, 2008 Share Posted November 26, 2008 Assuming that by "previous record"" you mean whatever record happens to be before the current record, in the current found set, according to the current sort order, you can use the GetNthRecord() function: Valuefield = GetNthRecord ( Valuefield ; Get ( RecordNumber ) - 1 ) If you are in a script, you can also move to the previous record, put the value in a variable and come back to do the comparison. Link to comment Share on other sites More sharing options...
lsmall Posted November 26, 2008 Author Share Posted November 26, 2008 (edited) The previous record would be based on an automated unique identifier serial number. So the comparison would always be (Value of field(x) in record with UI(y)) = (value of field(x) in record with UI(y-1)) This will be incorporated into a rather complex parsing script. I want the script to skip to the next found value if it encounters a consecutive repeat. Yes I have it set up to work with a navigation script, but I was wondering if there was a less convoluted way since my script is taking on a life of its own. One calculation to activate an exit loop is my goal. Thanks Edited November 26, 2008 by Guest Link to comment Share on other sites More sharing options...
lsmall Posted November 26, 2008 Author Share Posted November 26, 2008 This calc looks good. I will give it a try. I am trying to avoid additional script steps, so I would prefer not using go to previous record, but that would work as well as you suggested. Thanks a lot Link to comment Share on other sites More sharing options...
comment Posted November 26, 2008 Share Posted November 26, 2008 (edited) The previous record would be based on an automated unique identifier serial number Then you'll have to either make sure you have the necessary found set, sorted by the serial, or use a relationship to retrieve the value. There's probably a simpler way do whatever you're trying to do. Edited November 26, 2008 by Guest Link to comment Share on other sites More sharing options...
lsmall Posted November 26, 2008 Author Share Posted November 26, 2008 The "previous record" in this case is always the chronologically and physically previous record in the same found set. So the calc Valuefield = GetNthRecord ( Valuefield ; Get ( RecordNumber ) - 1 ) works perfectly and accomplishes exactly what I needed. Thanks for your help and very rapid replied. Link to comment Share on other sites More sharing options...
Recommended Posts
This topic is 5768 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