4D Blog

Home Tips Tips: ORDA Data Model Classes

Tips: ORDA Data Model Classes

August 18, 2020

Tips

By now you’re aware of the availability of ORDA classes. In this blog post, you’ll learn a few handy tips to get the most out of them!

UsE strongly typed variables

You can strongly type your ORDA variables and take advantage of autocompletion thanks to the var keyword.

In the example below, $dataclass is typed as a dataclass class (cs.Students) and initialized with the Students dataclass object (ds.Students). Autocompletion automatically suggests:

  • all of the functions defined at the dataclass level (new(), query(), etc.)
  • all of the functions that you’ve implemented yourself in cs.Students (in this example: search())

 

Call functions dynamically

You’ve most likely used the [ ] notation to access the attributes of an object (e.g., $myObject[“propertyName”]). This is also possible with functions!

Here’s an example (psst …. don’t forget the ( ) at the end!):

There is a getDescription() function defined on the datastore class.

Class extends DataStoreImplementation
Function getDescription
 C_TEXT($0)
 $0:="Learning system covering "+String(This.Students.all().length)+" students"

It can be dynamically called like this:
C_TEXT($what;$functionName;$1)
$functionName:=$1
// $functionName can be "getDescription"
$what:=ds[$functionName]()

Discuss

Tags API, Class, Data model, ORDA, Remote database, Remote datastore, REST server, v18 R4, v19

Latest related posts

  • April 9, 2025

    Restrict data according to privileges or information saved in session storage

  • April 7, 2025

    Designing an Interactive and Dynamic Menu Bar in Qodly application

  • April 3, 2025

    Customize your Qodly interfaces with CSS

Avatar
Marie-Sophie Landrieu-Yvert
• Product Owner • Marie-Sophie Landrieu-Yvert has joined the 4D Product team as a Product Owner in 2017. As a Product Owner, she is in charge of writing the user stories then translating it to functional specifications. Her role is also to make sure that the feature implementation delivered is meeting the customer need.Marie-Sophie graduated from the ESIGELEC Engineering School and began her career as an engineer at IBM in 1995. She participated on various projects (maintenance or build projects) and worked as a Cobol developer. Then she worked as an UML designer and Java developer. Lately her main roles were analyzing and writing functional requirements, coordinate business and development teams.
  • Deutsch
  • Français
  • English
  • Português
  • Čeština
  • Español
  • Italiano
  • 日本語

Categories

Browse categories

  • 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-Analyzer 4D for Android 4D for iOS 4D NetKit 4D Qodly Pro 4D View Pro 4D Write Pro 20 R8 20 R9 Administration Authentication Build application CI/CD Class Client/Server Code editor Collections Compatibility settings Formula Listbox Logs Mail Microsoft 365 Network Objects ORDA PDF Pictures Preemptive Programming Qodly Studio REST Scalability Security Session Source control Speed Spreadsheet Tutorial UI User Experience v20 vscode Web Word processor

Tags

4D-Analyzer 4D for Android 4D for iOS 4D NetKit 4D Qodly Pro 4D View Pro 4D Write Pro 20 R8 20 R9 Administration Authentication Build application CI/CD Class Client/Server Code editor Collections Compatibility settings Formula Listbox Logs Mail Microsoft 365 Network Objects ORDA PDF Pictures Preemptive Programming Qodly Studio 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