4D Blog

Home Tips 4D for Mobile Tutorial – Using Formatters

4D for Mobile Tutorial – Using Formatters

February 8, 2023

Tips

A data formatter allows you to map a data type from your database to a specific display on the mobile side. For example, you can define a date, percentage, or currency format. Data formatters can also call some code to create intelligent interfaces.

For example, you can attach a data formatter to phone numbers that open an action menu on the mobile app when the user touches the number (e.g., to call the person or save them in contacts).

You have three formatter types:

  • Built-in formatters
  • Static formatters
  • Dynamic formatters

Built-in formatters

This tutorial will show you how to apply built-in formatters to your fields. We will:

  • define a format for a Boolean and a date,
  • specify that a number is a percentage and another a currency.

 

Static formatters

The statics formatters allow formatting of the data. The transformation is described in a JSON file. You can download statics formatters from the gallery or create your own. For example, the formatter “BoolToImage” in the gallery displays a red circle when the value is false and a green circle for the true value.

This tutorial shows you how to create your formatters:

  • text to text,
  • integer to text,
  • integer to the image.

 

Dynamic formatters

The dynamic formatters contain Swift and Kotlin code for iOS and Android. As for the static formatters, you can download them from the gallery or create your own formatters. In the documentation, you have a tutorial with a step-by-step example to create a formatter for Swift and one for Kotlin.

This video will show you how to get a formatter from the gallery and integrate it into your project. 

Next…

Voilà! Now you know how to format your data in your mobile application. To go further, you can continue with the blog or the documentation.

Discuss

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

Latest related posts

  • June 27, 2025

    SHOWCASE: SMART COMMENT MODERATION WITH AI

  • April 28, 2025

    Tips & Tricks for your 4D Apps – April 2025 Edition

  • April 9, 2025

    Restrict data according to privileges or information saved in session storage

Vanessa Talbot
Vanessa Talbot
• Product Owner •Vanessa Talbot joined 4D Program team in June, 2014. 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.Since her arrival, she has worked to define key features in 4D. She has worked on most of preemptive multi-threading new features and also on a very complex subject: the new architecture for engined application. Vanessa has a degree from Telecom Saint-Etienne. She began her career at the Criminal Research Institute as a developer for the audiovisual department. She has also worked in media and medical fields as expert in technical support, production as well as documenting new features.
  • 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