4D Blog

Home Product Going back and forth between current selections to ORDA

Going back and forth between current selections to ORDA

April 13, 2018

Product

ORDA is a major innovation of 4D v17, this is why we’re dedicating an entire series of blog posts to ORDA. While ORDA has its own concepts that are very different from the classic approach, it’s still possible to mix ORDA with your existing code.

In a nutshell, this blog post will show you how you can update the current selection of a table from an entity selection and get an entity selection from the current selection of a table. It’ll allow you to smoothly integrate ORDA concepts into your existing 4D code, step by step.

Example: from entity selection to current selection and vice-versa

INTRODUCTION

With ORDA, data is accessed through an abstraction layer: the datastore. A datastore is an object which provides an interface to the database and its data through objects. And remember, with ORDA each table is mapped with a dataclass.

Once you have an entity selection related to a dataclass, you can update the current selection of the corresponding [Table] with the USE ENTITY SELECTION command. And, once you have a current selection on a [Table], you can get an entity selection related to the corresponding dataclass wtih the Create entity selection command.

To guide you through the exploration of ORDA features, we’ve prepared a glossary of the different terms and concepts, along with their definition.

Code Example

Current selection from an entity selection

In the code below, the $entitySelection entity selection is related to the Employee dataclass which actually corresponds to the same-named [Employee] table. The USE ENTITY SELECTION command updates the current selection of the table accordingly.

C_OBJECT($entitySelection)
$entitySelection:=ds.Employee.query("lastName=:1";"R@")
// The current selection of the [Employee] table is replaced according to the content of $entitySelection
USE ENTITY SELECTION($entitySelection)
//... Go on with your classic 4D code ...
PRINT SELECTION([Employee])
//...

entity selection from Current selection

Here, the current selection has been updated after performing a query on the [Employee] table. The Create entity selection() command creates the $entitySelection entity selection accordingly. The created entity selection is related to the Employee dataclass.

C_OBJECT($entitySelection)
// The current selection of the [Employee] table is updated after the query
QUERY([Employee])
// $entitySelection is created from the current selection of the [Employee] table
$entitySelection:=Create entity selection([Employee])

Discuss

Tags Database, Objects, ORDA, v17

Latest related posts

  • November 14, 2025

    Event Report in 4D Qodly Pro: See Every Interactions at a Glance

  • November 14, 2025

    4D Qodly Pro: Page Zoom Controls

  • November 13, 2025

    macOS Tahoe, Windows 11, which operating systems for 4D 20 and 21?

Avatar
Marie-Sophie Landrieu-Yvert
- Product Owner - Marie-Sophie Landrieu-Yvert joined the 4D Product team as a Product Owner in 2017. In this role, she is responsible for writing user stories and translating them into functional specifications. She also ensures that the delivered feature implementation meets the customer's needs. Marie-Sophie graduated from the engineering school ESIGELEC and began her career as an engineer at IBM in 1995. She took part in various projects (maintenance and development projects) and worked as a COBOL developer. She then moved on to work as a UML designer and Java developer. More recently, her main responsibilities included analyzing and writing functional requirements, and coordinating business and development teams.
  • Deutsch
  • Français
  • English
  • Português
  • Čeština
  • Español
  • Italiano
  • 日本語

Categories

Browse categories

  • AI
  • 4D View Pro
  • 4D Write Pro
  • 4D for Mobile
  • Email
  • Development Mode
  • 4D Language
  • ORDA
  • User Interface / GUI
  • Qodly Studio
  • Server
  • Maintenance
  • Deployment
  • 4D Tutorials
  • Generic
  • 4D Summit sessions and other online videos

Tags

4D AIKit 4D for Android 4D for iOS 4D NetKit 4D Qodly Pro 4D View Pro 4D Write Pro 20 R10 21 Administration AI Artificial Intelligence Build application Class Client/Server Code editor Collections Compatibility settings Formula Google Listbox Logs Mail Network Objects OpenAI ORDA PDF Pictures Preemptive Programming REST Scalability Security Session Source control Speed Spreadsheet Tutorial UI User Experience v20 vscode Web Word processor

Tags

4D AIKit 4D for Android 4D for iOS 4D NetKit 4D Qodly Pro 4D View Pro 4D Write Pro 20 R10 21 Administration AI Artificial Intelligence Build application Class Client/Server Code editor Collections Compatibility settings Formula Google Listbox Logs Mail Network Objects OpenAI ORDA PDF Pictures Preemptive Programming REST Scalability Security Session Source control Speed Spreadsheet Tutorial UI User Experience v20 vscode Web Word processor
Subscribe to 4D Newsletter

© 2025 4D SAS - All rights reserved
Terms & Conditions | Legal Notices | Data Policy | Cookie Policy | Contact us | Write for us


Subscribe to 4D Newsletter

* Your privacy is very important to us. Please click here to view our Policy

Contact us

Got a question, suggestion or just want to get in touch with the 4D bloggers? Drop us a line!

* Your privacy is very important to us. Please click here to view our Policy