4D Blog

Home Product 4D for Mobile: Build Great Mobile Apps Using Computed Attributes

4D for Mobile: Build Great Mobile Apps Using Computed Attributes

October 11, 2021

Product

As you probably know, computed attributes are available starting from 4D v19 R3. A blog post is available that presents this great new feature.

As we always propose the best and complete user experience to our mobile app developers, computed attributes are compatible with all your iOS and Android projects. 

This means that as soon your getters are defined, you can use them as any other field in your mobile app creation process. So you’ll be able to visualize and publish them from the Structure section of the mobile project editor. This is a considerable improvement when it comes to displaying more relevant information in your mobile app, avoiding splitting an address into several fields for example.

Let’s see how it works with an example. We’ll display a computed fullname field with a first name and last name and a fulladdress computed field using a street number, city, and country fields.

4D side

As you can see in the structure, a FirstName and a LastName attributes are available. We want to display “FirstName LastName” in our mobile app. 

In the same way, we have a StreetNumber, an Address, and a Location attributes. And we want to display “StreetNumber  Address – Location.”

For that, let’s extend the ContactEntity class:

Class extends Entity
exposed Function get fullName->$result : Text
 $result:=This.FirstName+" "+This.LastName
exposed Function get fullAddress->$result : Text
 $result:=This.StreetNumber+" "+This.Street+" - "+This.Location

Now let’s go back to the mobile project editor.

Project editor side

As you can see in the project editor, your computed attributes are now available from the structure section, ready to be published and used as any other field in the creation process.

blank

This means that you can use them in the Data section to filter your data, add an icon, as well as short and long labels. You can also use them as action parameters as soon as a setter is available. Still, in this example, it was more relevant to use single attributes in action forms to make editing easier.

Now let’s build our app!

Mobile app side

In our final app, both single attributes and computed attributes are displayed.

blank

So as you can see, this new feature allows more advanced use of the existing templates and displays more information in a relevant way.

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, Computed attribute, Go mobile, Mobility, v19 R3, v20

Latest related posts

  • June 16, 2025

    Generate, share and use web sessions One-Time Passcodes (OTP)

  • May 20, 2025

    Automatic Refresh of OEM Build Licenses

  • May 16, 2025

    New class to handle incoming TCP connections

David Azancot
David Azancot
• 4D for iOS Product Owner •David Azancot joined the 4D Product team as a Product Owner in 2017. He's in charge of writing the user stories and translating them into functional specifications. His role also includes making sure that feature implementations meet customers' needs.David graduated with an MBA in Marketing, Internet and Mobility from the Leonard De Vinci Institute and began his career in 2011 with a mobile start-up company, later acquired by Madvertise (a mobile marketing group). Passionate about mobile interfaces, he was the 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

  • 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