Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to know records were edited or deletion by Other use
Message
From
18/10/2000 12:15:40
 
 
To
18/10/2000 11:00:35
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00430813
Message ID:
00430986
Views:
10
Sorry, I post this again to send this as reply to all other members of this thread

>If i use CURVAL or OLDVAL, both return correct value and I can know the changes, but It need to loop through all of the fields.
>
>
>Any ideas?

Whats the problem? This operation is quick because it works with buffered data in memory. Sample of updating session with checking for changes on the server:
if !tableupdate(.F.,.F.) && when cannot update, check if reason is changes on server
  local lnFieldIndex, lcFieldName
  select MyAlias
  for m.lnFieldIndex = 1 to FCOUNT()
    m.lcFieldName = Field(m.lnFieldIndex)
    if type(m.lcFieldName) == 'G' && skip general fields
      if !(OldVal(m.lcFieldName) == CURVAL(m.lcFieldName))
        * Oops - something changed on the server by another user - prompt to overwrite
        ...
        if !llOverWrite && if user answered to do not overwrite
          && update current value by changed value from server
          replace (m.lcFieldName) with CURVAL(m.lcFieldName)
        endif
      endif
    endif
  ENDFOR
  * WARNING - special checking for deleted records
  if CURVAL('Deleted()')
    * Oops - record already deleted by another user
    * ask to recover it or keep deleted
    ...
    if llRecover && if user answered to recover record
      && following 2 commands needed to assure correct update on server
      delete
      recall
    else
      && delete record in local buffer as well
      delete
    endif
  endif
  
  if !tableupdate(.T.,.F.)
    && error - cannot update at all
  endif
endif
Vlad Grynchyshyn, Project Manager, MCP
vgryn@yahoo.com
ICQ #10709245
The professional level of programmer could be determined by level of stupidity of his/her bugs

It is not appropriate to say that question is "foolish". There could be only foolish answers. Everybody passed period of time when knows nothing about something.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform