Wolfe, Stephen S YA-02 6 MDSS/SGSI wrote:
> *'  Get a data refresh on rvCheckIn
> LOCAL nMinutes, cMinutes
> nMinutes=0
> cMinutes=""
> *' suspend
> SELECT rvCheckIn
> TABLEUPDATE(.T.,.T.)
> REQUERY()
> GO BOTTOM
> GO TOP
> *'  OK, I'm a little paranoid when do a requery, but it is stable ...
>
> *' Note to self -- Change filter to DBC control in the remote view ...
> when you have time
>
> IF oApp.clinic="LIFESKILLS"
>       SET FILTER TO date_of_appt=DATE() AND
> ALLTRIM(clinic)==ALLTRIM(oApp.Start_Page) AND
> ALLTRIM(rvCheckIn.subclinic)=ALLTRIM(oApp.subclinic)
> ELSE
>       SET FILTER TO date_of_appt=DATE() AND
> ALLTRIM(clinic)==ALLTRIM(oApp.Start_Page)
> ENDIF
>
> *'  Force a table update
> SCAN
>       nMinutes=(CTOT(TIME())-CTOT(rvCheckIn.Arrival_time))/60
>       cMinutes=ALLTRIM(STR(nMinutes))
>       Replace wait_time1 with cMinutes
>       
> ENDSCAN
>
> TABLEUPDATE(.T.,.T.)
> REQUERY()
> GO BOTTOM
> GO TOP
>
>
> *******************  End Code snippet  ****************
>
> This is old dusty code that works, but I think it is sloppy and wasting
> Compute cycles.  I'm particularly interested in improving the SCAN block
> by
> Removing it and using an UPDATE SQL statement.  When I tried that I got
> a expression error.  All I did was combine the computation of nMinutes
> and the conversion of that var into a character format into one
> expression.  The fox didn't like that.
>
> So, how would you all improve the above code?  
>
>   

Well, if it ain't broke, ....  <g>

Seriously though, if you're interested in cutting out cycles, I minor 
(can't stress than enough!) tweak might be to replace the SCAN loop with 
this:

Replace wait_time1 with 
ALLTRIM(STR((CTOT(TIME())-CTOT(rvCheckIn.Arrival_time))/60)) ALL in rvCheckIn


OR ... just have that as a computed field in your view, so the Requery command 
does all of the work for you in its call!




-- 
Michael J. Babcock, MCP
MB Software Solutions, LLC
http://mbsoftwaresolutions.com
http://fabmate.com
"Work smarter, not harder, with MBSS custom software solutions!"



_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: http://leafe.com/archives/byMID/profox/[EMAIL PROTECTED]
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to