4D Blog

Home Product ORDA: Easy looping with a new 4D tag

ORDA: Easy looping with a new 4D tag

April 22, 2021

Product

You have probably already used a For each…End for each loop to work with ORDA entity selections or with collections. Its use is simple and straight forward.  Would like to use it as a 4D tag in your SHTML pages? Or perhaps with the PROCESS 4D TAGS command?

As of 4D v19, you can! Keep reading to learn more.

HDI: 4DEACH tag

A new 4D tag is now available: the 4DEACH tag. 

Its use is very similar to a For each…End for each loop.

Just a reminder

Here is a simple example to remind you how to use a For each…End for each loop on an entity selection:

var $customer : cs.CustomersEntity

For each ($customer; ds.Customers.all())
 $customer.name:=Uppercase($customer.name)
 $customer.save()
End for each

and now let’s use the new 4DEACH tag

In this blogpost, we showed you how to put some data related to the user in the web session.  For example, a salesperson’s top three customers.

The following is the SHTML code to display these top three customers (Session.storage.myTop3) which is an entity selection.

We can verify the 4DEACH tag allows looping through it.

customers.shtml file:

<table class="table">

<tr><th>Name</th><th>Total purchase</th></tr>

<!--#4DEACH $customer in Session.storage.myTop3-->
<tr>
<td ><!--#4DTEXT $customer.name--></td>
<td ><center><!--#4DTEXT String($customer.totalPurchase;"$###,##0")--></center></td>
</tr>
<!--#4DENDEACH-->

</table>

 

And here is the result:

 

As you can see, the syntax is very similar to a For each…End for each loop.

The tag also works for collections and objects (to loop through an object’s properties).

It’s also supported by the PROCESS 4D TAGS and WEB SEND FILE commands. 

Download the HDI above to play with this new tag and join the discussion on the 4D forum!

 

 

Discuss

Tags Collections, Objects, ORDA, v19, Web

Latest related posts

  • December 3, 2025

    Give AI to a 30 years old 4D application

  • November 28, 2025

    ORDA – Handle an event-driven logic during database operations

  • November 27, 2025

    ORDA – Permissions – Restrict / allow web access to the resources in one click

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