Kevin,
I agree entirely regarding editing... a definite NO NO!!

However, Sales people being what they are, they tend to simply browse a grid 
and leave the grid as it is as opposed to refreshing it even occasionally.
I think I may well put a timer on the form and simply refresh it and return to 
the top of the cursor (record 1) regardless of where they were pointing.

I was interested in any other techniques that people were using. I must admit 
that CA's are brilliant in this respect as they are refreshable without moving 
the record pointer - which I have only just discovered, being as how I have 
always used SPT but this particular project of updating from VFP tables to SQL 
tables means that CA's or remote views are a drop in replacement for VFP tables 
in the Data Environment of a form as opposed to having to hand code all the 
cursors.

Dave


-----Original Message-----
From: ProFox [mailto:[email protected]] On Behalf Of Kevin Cully
Sent: 04 August 2015 16:33
To: [email protected]
Subject: Re: SQL Pass Through (SPT) Grid refresh

I use SPT and I never allow for editing of values in a grid.  Here's how I've 
approached the issue...

In the LOAD event I do my first SPT with a "SELECT field1, field2,
field3 FROM myTable WHERE 1=2;" into a cursor (lets call it c_MyTable) that 
lives throughout the life of the form.
In the INIT event, I bind my grid to c_MyTable and set my column headers.
In that same INIT, I will do my default search calling THISFORM.SearchMyTable( 
THISFORM.txtSearch.Value ) which should be empty at this point.
If someone types into the THISFORM.txtSearch field, in the InteractiveChange 
event, it calls through THISFORM.SearchMyTable( THISFORM.txtSearch.Value ).
In the THISFORM.SearchMyTable() method, it does something like this....

PARAMETER tcSearch
lcCommand = "SELECT field1, field2, field3 FROM myTable WHERE
TRIM(field1) LIKE '" + tcSearch + "%' ORDER BY field1 LIMIT 1000;"
llSuccess = goApp.SPTSelect( lcCommand, 'tempMyTable' )

DO CASE
     CASE NOT USED("tempMyTable")
         && Problem!
     CASE NOT USED("c_MyTable")
         && Problem!
     OTHERWISE
        SELECT c_MyTable
        && Make sure SET SAFETY IS OFF
        ZAP
        APPEND FROM DBF(tempMyTable)
        USE IN tempMyTable
        && Refresh the grid and set LockScreen = .F.
ENDCASE

I can get clickable headers as long as it works with the limit of 1000 records 
above by modifying the grid or using a subclass. Worked for me for years and 
years.

HTH.

CULLY Technologies, LLC
http://cullytechnologies.com
http://cully.biz

On 08/04/2015 11:05 AM, Dave Crozier wrote:
> Just asking those of you out there who use SPT with an SQL Back End how you 
> handle Grid refreshes (refreshing the underlying data) when browsing tables 
> on the main data server assuming that you may well stay on a browse window 
> when  somebody else may well update the data.
>
> I am just trying to write a small set of demo forms using Remote views, 
> Cursor Adapters as well as SPT for Tom here in order to better explain the 
> advantages/disadvantages of each data access method. Obviously with cursor 
> adapters you can issue a cursorRefresh() against the back end and with remote 
> views you can do a requery() against the view. The only method I use with SPT 
> is in fact to issue the "select..." again.
>
> Anyone got any better suggestions apart from using stored procedures on the 
> back end which I don't really want to use.
>
> The nice thing about the remote view and cursor adapter method is that the 
> currently selected row gets preserved in the grid. I have tried the same in 
> SPT by saving the current row and navigating to it after the re-select but it 
> causes screen glitches regardless of using _Screen.Lockscreen unless anyone 
> else has a better idea!
>
> Dave
>
>
>
> --- StripMime Report -- processed MIME parts --- multipart/alternative
>    text/plain (text body -- kept)
>    text/html
> ---
>
[excessive quoting removed by server]

_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: http://mail.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