Log In    |    Knowledge Base    |    4D Home
Tech Tip: Ordered vs Unordered Entity Selections
Published On: October 19, 2018
Your current browser may not allow you to download the asset. We recommend Mozilla Firefox or Google Chrome.
Log In

In addition to ORDA's new features, entity selections can also be ordered or unordered. If not specified, entity selections are default to unordered when initially created. The table below demonstrates some of their differences in terms of memory and speed.

Specifically for memory, each entity in an unordered entity selection takes only one bit which represents whether that entity is selected. As a result, it becomes very simple to calculate the size of an unordered entity selection as the size in bytes is equal to the number of entities divided by 8 (E.G. 10,000 entities = 1,250 bytes). For ordered selections, each reference to an entity takes 4 bytes in memory which is much more taxing in space.

Below are several different ways to create ordered and unordered entity selections.

Both of these types of entity selections have their advantages and disadvantages so always consider your objective in terms of speed, size, and entity references before deciding on which type to use.