Hi,

! recently discovered this while investigating a particularly transient bug => If I delete a record which was part of an entity selection and then create a new one, that replaces the deleted one in the entity selection.

I can't see anything in the developer docs which explains this, but posting here before I submit a bug report in case it's actually supposed to be a feature!

I've tried in v17.1 and v19R6 - same results in both.

---

C_OBJECT ($esSyncOuts) // or var $esSyncOuts : Object  (or cs.sync_outSelection) - makes no difference

  // clear any records from previously running this code!
READ WRITE([sync_out])
QUERY([sync_out];[sync_out]sequence=0)
DELETE SELECTION([sync_out])
READ ONLY([sync_out])

// create a record with known ID with lowest possible sequence
CREATE RECORD([sync_out])
[sync_out]ID:="AAAA" // UUID key field
[sync_out]sequence:=0 // Integer
SAVE RECORD([sync_out])

// create ordered entity selection, with new record as the first one
$esSyncOuts:=ds.sync_out.all().orderBy("sequence")
ALERT($esSyncOuts[0].ID)  // AAAA as expected

// delete the newly added record - $esSyncOuts[0] becomes undefined
READ WRITE([sync_out])
QUERY([sync_out];[sync_out]sequence=0)
DELETE RECORD([sync_out])
READ ONLY([sync_out])

// create another new record with different known ID with lowest possible sequence
CREATE RECORD([sync_out])
[sync_out]ID:="BBBB"
[sync_out]sequence:=0
SAVE RECORD([sync_out])

ALERT($esSyncOuts[0].ID) // this is now BBBB!
**********************************************************************
4D Internet Users Group (4D iNUG)
New Forum: https://discuss.4D.com
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**********************************************************************

Reply via email to