Ugo DI LUCA Posted March 30, 2004 Posted March 30, 2004 This must be a very dumb querry. Would Max(::RelatedByConstant:CompoundModDateAndHour) always return the Latest Compound suitable for a relationship to an Indexed Field in the Related File. I'm trying to find out the best way to grab the latest modified ID in a related file. Would a concanation of Time and Hour get greater and greater, Version: v6.x Platform: Mac OS 9
-Queue- Posted March 30, 2004 Posted March 30, 2004 I should think if you used a concatenation of date and time set as a number, the number would increment as desired.
Ugo DI LUCA Posted March 30, 2004 Author Posted March 30, 2004 Hi JT, Thanks for the confirmation. It works a charm. I was concerned I could have missed some point before going this way. Version: v6.x Platform: Mac OS 9
BobWeaver Posted March 30, 2004 Posted March 30, 2004 Although it's undocumented, you can use the Last() function to do this. It will always retrieve the value from the last related record.
Ugo DI LUCA Posted March 30, 2004 Author Posted March 30, 2004 Hi, In this instance Bob, I was looking for the latest modified value, not just the latest value. Am I missing something ? Version: v6.x Platform: Mac OS 9
-Queue- Posted March 30, 2004 Posted March 30, 2004 If you have the relationship sorted by date and time fields [ascending], then Last( ) will give you the most recently modified value. If you sort them descending, ::RelatedByConstant:CompoundModDateAndHour itself will give you the correct value since the first related record is the most recent. It all depends on which one works faster for you. I think either of these methods would be faster than a Max( ), but I'm not sure whether the difference is negligible with a large record set.
Ugo DI LUCA Posted March 31, 2004 Author Posted March 31, 2004 Wow, How could I miss this obvious. I was focussed on the Concanation field, and totally forgot the individual fields themselves. Sure, as they are indexed (scripted), these would be suitable for a sorting relationship. Thanks both of you. Version: v6.x Platform: Mac OS 9
Recommended Posts
This topic is 7612 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