KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Transitioning between current selection and entity selection using ORDA
PRODUCT: 4D | VERSION: 17 | PLATFORM: Mac & Win
Published On: September 14, 2018

With the introduction of 4Dv17, ORDA now offers a new way to retrieve and update query data using entity selection. Entity selection is ORDA's version of storing data from a resulting query similar to current selection however, entity selections are treated as objects. This feature can be very useful when you still want to utilize your current selection, but want to take advantage of the object dot notation for shorter syntax.

C_OBJECT($peopleSelection)

$peopleSelection:=ds.People.query("firstName = :1";"A@")
USE ENTITY SELECTION($peopleSelection)

In this example, we are updating a current selection from an entity selection. First we query for all the records in the People table whose first name starts with 'A'. An entity selection is initialized as an object and the query result is stored into this object. However, our current selection is not yet updated and we'll need to use the USE ENTITY SELECTION to update the current selection for the People table.



Here are the results from our current selection [People] and entity selection $peopleSelection. Next example is how to create an entity selection from an existing current selection.

C_OBJECT($peopleSelection)

QUERY([People];[People]firstName="A@")
$peopleSelection:=Create entity selection([People])

In this example, the order has changed. We first update the current selection for the People table using QUERY. Afterwards we update our entity selection using Create entity selection and pass in the current selection from [People] as the argument.


The results again are the same. The only difference for you to decide is whether you want to create a current selection from an entity selection or create an entity selection from a current selection.