The only sensible way to do this, as others have said, is using cursors
or views.

Personally I would not have a 'ticked' field in my base table at all,
but I would definitely have an auto-incremented primary key unique ID
field .

SQL select whatever records you need into a cursor, with an added
'ticked' field and indicator fields, i.e.

'select id,x,y,z,.f. as ticked, .f. as modified,.f. as added,.f. as
deleted from mytable where a=b into cursor mycursor readwrite'

Then base your grid on this cursor, you would hide the 'id', added,
modified, deleted fields as they will only be used when updating the
backend table.

When the user adds a record then append it to the cursor with id=-1 and
added=.t.

When they edit a record save the changes to the cursor with modified=.t.

When they delete a record set deleted=.t.

When the user chooses to save all changes then scan through the cursor
and:

Where added=.t., insert a record with those values into the base table,
I would use 'scatter name' and 'insert into from'. You leave the 'id'
field out of this as it is auto-generated.

Where modified=.t., locate the correct base table record using the 'id'
field, then 'scatter name' from the cursor and 'gather name'.

Where deleted = .t. locate the correct base table record using the 'id'
field and DELETE(), or 'delete in mytable where id=mycursor.id' etc.

This is a 'last in wins' approach of course, which is the only one I
would bother with in 99% of situations.



On Mon, 04 Oct 2010 15:21 +0800, "wtc" <[email protected]> wrote:
> Paul,
> It's really good idea, at least it work for some situation.
> But if both user had selected the same record to be filtered, then there 
> we got a problem. b'coz the last user will replace the previous user 
> marked and the previous user filter will not show the record he have 
> selected.
> 
> I think at the moment I wll apply this solutin first.
> 
> wtc
> 
> 
> 
> On 4/10/2010 2:57 PM, Paul Ammoun wrote:
> > Hello,
> >
> > you should have a field that contains user name that is filtering the data.
> > so instead of doing set filter to show_it you will then do set filter to
> > show_user=pcusername
> >
> > Hope this help
> >
> > Paul
> >
> >
> > On Mon, Oct 4, 2010 at 8:27 AM, wtc<[email protected]>  wrote:
> >
> >    
> >> Dear Foxes,
> >>
> >> I have a stock master file call "stock.dbf" and user(admin) can directly
> >> update the data from the grid form I have designed.
> >>
> >> For the stock.dbf i have a field name "show_it L(1)" as a marking to
> >> show this record when user want to filter records based on their need by
> >> tick the show_it column.
> >>
> >> Now my problem is, when there are more then 2 users(using separete pc)
> >> to update the show_it column based on their own need, but when the user
> >> click "Filter" button, all thing mixed up.
> >>
> >> I use "Set filter to show_it" on the button click.
> >>
> >> How I am going to solve this problem? since they are using the stock.dbf
> >> directly. They want to use stock.dbf directly b'coz easy for them to
> >> update data instantly from the grid form.
> >>
> >> Sorry for my poor english. Hope some one can help me on this again.
> >>
> >> Thank you very much.
> >> wtc
> >>
> >>
> >>      
[excessive quoting removed by server]

_______________________________________________
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