The manipulation of dates and times often requires specific formatting for various representations based on 4D’s internal resources or operating system settings.
While the default formats are usually all you need, there are scenarios in which custom formatting is essential, particularly for different geographical locations or unique requirements. In 4D v20 R4, significant advances have been made to meet this precise need
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:
Several formatters have been made available for formatting your data in the list or detail form. For example, a boolean field can be represented as a red or green circle. If you think this is very convenient, then you will love the new features in 4D v19 R5.
Let’s imagine an application with a list of our customers, if we need to go to their offices, it would be really handy to be able to tap on the customer’s address to open Google Maps. Unfortunately on the way, you are stuck in traffic. Don’t panic, just tap on the phone number, and you can choose to send a message or call directly to let them know. 🙂
Several other formatters are at your disposal, we let you discover them.
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.
Until now, custom formatters allowed you to match text or images to the contents of a field, such as replacing true/false with an image or 1, 2 with text labels. 4D v19 R3 allows you to create action input controls available from actions forms, such as creating a choice list with predefined text. And even better, this list can be dynamically filled using a datasource such as a list of employers. Let’s delve into the details!
For some time, you’ve been able to create your own custom data formatters and convert strings, booleans, or integers to images in your generated app.
This new 4D v19 R2 feature will allow you to take full advantage of those formatters for iOS and Android, and make sure images look good in both light and dark appearances.
Let’s see how!
With 4D v17 R3, we introduced basic data formatters for dates, percentage, time, etc. 4D v17 R4 takes things a step further by providing you the ability to create your own data formatters and use them directly from the Project Editor.