4D Blog

Home Product 4D for Mobile: Use Object Attributes

4D for Mobile: Use Object Attributes

January 17, 2022

Product

As of now, you can use almost all types of attributes in your mobile projects: text, dates, time, integers… 4D v19 R4 is bringing another one.

Say hello to object attributes.

Project editor side

As soon as you have object attributes in your 4D structure, you can publish them from the Structure section.

You can define an Icon, Short and Long labels, or formats just like any other attributes from the Labels and Icons section.

Two formats are already available to display your object attributes :

  • Human readable: default format, displays human-readable structured data in your mobile app
  • JSON Pretty Print: displays an indented JSON in your mobile app

Then you only have to drop your fields in your list or detail forms from the Forms section to display them in the generated mobile apps:

Mobile app side

As you can see, your object attributes are well displayed on iOS and Android:

blank

 

Go further

 You are totally free to customize and adapt the mobile display to suit your needs. To do so, you can use two methods:

  • Computed attributes, to create the required format server-side
  • Swift formatters, to display only the values you need a client-side

COMPUTED ATTRIBUTES

In the following example, we want to display an address getting only relevant values that are available in the next object using computed attributes:

$Obj:=New object 
$Obj.name:="4D SAS" 
$Obj.address1:="66 rue de Sartrouville" 
$Obj.address2:="Parc les Erables, bâtiment 4" 
$Obj.zipCode:="78230" 
$Obj.city:="Le Pecq" 
$Obj.country:="France" 
$Obj.phoneNumber:="+33 1 30 53 92 00" 
$Obj.website:="fr.4d.com"

$Ent:=ds.Employees.get(4)
$Ent.Object_Attribute:=$Obj
$Ent.save()

For that, let’s extend the EmployeesEntity class:

Class extends Entity
exposed Function get fullAddress->$result : Text
 $result:=This.Address.name+" - "+This.Address.address1+" - "+This.Address.zipCode+" "+This.Address.city

As simple as that! 

SWIFT FORMATTERS

Using a swift formatter will allow you to get more amplitude to display your object attributes in the way you want, putting your text in bold or adding styles and colors, for example. A tutorial is available here to build your first Swift formatter!

Don’t hesitate to give us feedback on the 4D forum, and check out the documentation for more details!

Discuss

Tags 4D for Android, 4D for iOS, Formatter, Go mobile, Mobility, v19 R4, v20

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

David Azancot
David Azancot
– 4D for iOS Product Owner – David Azancot joined the 4D Product team as a Product Owner in 2017. He is responsible for writing user stories and translating them into functional specifications. His role also includes ensuring that feature implementations meet customer needs. David holds an MBA in Marketing, Internet, and Mobility from the Institut Léonard de Vinci. He began his career in 2011 at a mobile startup that was later acquired by Madvertise (a mobile marketing group). Passionate about mobile interfaces, he was a natural choice to develop interactive mobile ad formats for the group in 2015. In parallel, David has been developing his own iOS and Android applications since 2012.
  • 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