KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: entitySelection[index] is a non assignable expression
PRODUCT: 4D | VERSION: 17 | PLATFORM: Mac & Win
Published On: June 6, 2019

When working with entity selections, recall that the expression entitySelection[index] cannot be assigned to any value.

C_OBJECT($selection_e;$ent_e)
$selection_e:=ds.Table_1.all()
$ent_e:=ds.Table_1.new()
$selection_e[3]:=$ent // invalid assignment




Instead, assign a variable to the entity at that particular index and modify the attributes from that variable. Also make sure that the index is within range of the entity selection.

C_OBJECT($selection_es;$ent_e;$status_o)
C_LONGINT($selectionLength_l;$pos_l)

$selection_es:=ds.Table_1.all()
$pos_l:=3 // index of entity that will be changed

If ($pos_l<$selection_es.length)
   $ent_e:=$selection_es[$pos_l]
   // make changes to the entity here
End if