June 3, 201015 yr Is there something like an opposite version of the "Last" function that will find the FIRST non-empty record? I am trying to calculate the time between my first record (with an associated timestamp) and my last record (with an associated timestamp.
June 3, 201015 yr None required. Any time you get a related field you are always getting the first value - as defined by the sort order of the relationship. Set variable [ $first; LineItems::ProductID] Set variable [ $last; Last(LineItems::ProductID) ]
June 3, 201015 yr A reference to a related field returns the value from the first related RECORD - not necessarily the first VALUE: if the field happens to be empty in the first record, the reference will return empty too. The exact opposite of the Last() function, i.e. one that returns the first non-empty value, would be = GetValue ( List ( Related::Field ) ; 1 )
June 3, 201015 yr Well, I do think it is important for the OP to understand the details of how this works, and consider whether he want the first non-empty value (which could the 13th value) ; or the true first value - empty. If in fact that is the result of the data contents and relation sort order.
June 3, 201015 yr Yes, I believe a simple reference may suffice in this case, as it doesn't seem likely that the value will be ever empty. I only added the clarification because the OP specifically asked for value from "the FIRST non-empty record".
June 3, 201015 yr Author Yes, I am looking for the first non-empty value, as defined by the sort order.
June 3, 201015 yr Author Hmm, the "GetValue..." solution isn't working. I currently have the calc below, but it isn't giving me a real number for everything because it is finding the first value, and not the first NON-EMPTY value. And for some, the first value is empty. (Last (Behavior to Follow by Date ID#:Timestamp_Begin) - ( Behavior to Follow by Date ID#::Timestamp_Begin ))/60 When I change it to incorporate comment's solution I get unusable values for all records. My adjusted calc that doesn't seem to work at all looks like this: (Last(Behavior to Follow by Date ID#::Timestamp_Begin) - GetValue(List(Behavior to Follow by Date ID#::Timestamp_Begin) ; 1))/60
June 3, 201015 yr Try = ( Last ( Behavior to Follow by Date ID#:Timestamp_Begin ) - GetAsTimestamp ( GetValue ( List ( Behavior to Follow by Date ID#::Timestamp_Begin ) ; 1 ) ) ) / 60
Create an account or sign in to comment