[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index] [Date Index] [Thread Index]
[SQR-USERS Info] [SQRUG Home Page]

Re: Finding minumums



Firstly:  You do not have an sqr problem, you have a data entry and
interface design problem.

Having said that, my next question is:

Are each of the segments in the comments field the same size?
800-1500--TRC: REG--HRS: 7

in other words, can you always assume that the first four digits are the
start time?

Can you assume that all of the comments are time  related?  If so, try this
:

select  substr(comments, (length(comments)- 22), 4) as final_end_time

what this does is takes a substring from an absolute position in the
substring.  If you have more than just time comments -- and you probably
do -- you're in for some real coding fun.

Here is what I would do :

  get the length of the comments.
  create a loop and start at the end of the comments

   move length(comments) to #len_var
   move 0 to #found

   while #found = 0

            let #len_var =  #len_var -20
            #found = instr(&comments, '--TRC', #len_var)
            if #len_var < 0
                move -1 to #found
            end-if

end-while

     At this point, if #found is negative, it didn't work.
     If #found is positive, then it is the location of the last digit of
time.

   ltrim ((rtrim(( substr(&comments, #found-4, 4)), '-')), '-') should give
you the last checkout time.