Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Dragging the other of fields names.
Message
From
26/02/1998 09:34:36
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
 
 
To
25/02/1998 12:10:51
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
00080530
Message ID:
00081349
Views:
25
>>>Hi Jim
>>>My user want to be able to INSERT a record (using a GRID) right below the current record by clicking on a INSERT button. The table I am using only has 3 fields, NAME,DATE,SORTFLD. In most cases the dates will be the same value. I am having problems on how to approach this problem. I can use the SORTFLD (a float) to do my sorting. There will probably not be anymore than five records in the GRID. This is my problem. :)))))))
>>
>>Robert, when the suer clicks the button the recrod pointer in the recordsource for the grid is sitting on the record tehy were on. You can simply
>>
>>
>>INSERT INTO GridSource (SortFld)
>> VALUES (GridSource.SortFld + .001)
>>
>>Then refresh the grid.
>---
>Hi Jim
>
>Your code does INSERT a record, but what if the user tries to
>INSERT a record using the record they just inserted as the current record.
>example…
>SORTFLD = 2.000
>They insert and the new record is SORTFLD= 2.001
>The current record is SORTFLD= 2.001
>They insert and the new record is SORTFLD= 2.002
>The current record is SORTFLD= 2.001
>If they insert here, the new record will be SORTFLD= 2.002 (again)
>What do you think?

You'll have to jump up and down a little: get the next record's sortfld, and put the new record's sortfld halfway; if you are adding new record at the grid's bottom, simply double the last value. Once you get your sortid for your new record, you'd have to Go Bott, replace the last sortId with, say, 1000 (supposing you have ten records), skip back, replace with 900, skip back, replace with 800 etc - and then jump to your new record. This way, after any new record added, you renumber your SortIds, so you may even use integers.

I have assumed the SortId column is not shown in the grid.

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform