Pat,
I'm not using v17 - so i can't help directly,
but

How about doing this instead - should be faster
On load of form (or change of content of listbox)
  create a set - "listbox_display"

on delete
use set (listbox selection set)
delete selection
use set("listbox_display")   // no query needed
Sort

also - 
shouldn't you have a sort direction specified ?
i.e.
ORDER BY([ListItems];[ListItems]ItemText; > )

one other possibility -
automatic relations, if there is one to or from [list_items] table
maybe it is causing a change in selection during the sort


Chip
On Wed, 23 Jan 2019 23:13:44 +0000, Pat Bensky via 4D_Tech wrote:
> Using v17r3, Mac:
> 
> I have a listbox that displays a selection of records from the [ListItems]
> table, which are related to a record in the [Lists] table.
> User can select an item in the list and click the Delete button to delete a
> [ListItem] record. The code that runs:
> 
> *USE SET*("ListboxSet0")
> 
> *DELETE SELECTION*([ListItems])
> 
> *QUERY*([ListItems];[ListItems]ListNumber=[Lists]RecordNumber)
> 
> *ORDER BY*([ListItems];[ListItems]ItemText)
> 
> What happens is that after the ORDER BY line, the selection of [ListItems]
> records changes. For example:
> 
> Click Delete button: there are 51 ListItems selected
> *USE SET*("ListboxSet0") now one ListItem is selected
> 
> *DELETE SELECTION*([ListItems])      0 ListItems selected
> 
> *QUERY*([ListItems];[ListItems]ListNumber=[Lists]RecordNumber)     50
> ListItems selected
> 
> *ORDER BY*([ListItems];[ListItems]ItemText)    Now there are 12 ListItems
> selected!
> 
> 
> The same thing occurs if a new record is added to ListItems.
> 
> 
> Note that this running inside a transaction. If I insert
> 
> VALIDATE TRANSDACTION
> 
> after deleting or adding a record, it all works correctly. But I don't want
> to validate the transaction at that point, and I don't understand why that
> would be necessary.
> 
> 
> Bug?
> 
> 
> PB
> 
> 
> -- 
> *************************************************
> CatBase - Top Dog in Data Publishing
> tel: +44 (0) 207 118 7889
> w: http://www.catbase.com
> skype: pat.bensky
> *************************************************
> **********************************************************************
> 4D Internet Users Group (4D iNUG)
> Archive:  http://lists.4d.com/archives.html
> Options: https://lists.4d.com/mailman/options/4d_tech
> Unsub:  mailto:[email protected]
> **********************************************************************
---------------
Gas is for washing parts
Alcohol is for drinkin'
Nitromethane is for racing 
**********************************************************************
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:[email protected]
**********************************************************************

Reply via email to