4D for Mobile: Say Hello to Aliases

As you probably know, aliases have been available since 4D v19 R4. Aliases and computed attributes were a massive step forward for our development framework!

The days of defining business-related formulas in your 4D user interface are over; these concepts offer you a new way to separate your business logic from the UI, enabling you to improve performance by optimizing the parts separately.

And now, with 4D v19 R6, aliases are fully available and ready to use for scalars in your iOS and Android mobile projects as soon your aliases are defined on the 4D side.

With the v19 R6 you can display in the same mobile screen values from anywhere in your database :

Reminder about Aliases

An alias is nothing more than a synonym or shortcut to an existing datastore object.

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 represents a considerable improvement allowing you to retrieve values at several degrees of depth and display even more relevant information in your mobile app.

Let’s have a look at this feature with a simple example.

Note: Please note that entity and entity selection are not yet supported.

Concrete example

4D structure

As you can see, an employee is related to an office related to a country with a corresponding flag.

blank

So on the 4D side, we are going to create the following aliases :

Class extends Entity
exposed Alias aliasOfficeAddress office.name 
exposed Alias aliasOfficeCity office.city 
exposed Alias aliasPhoneNumber office.phoneNumber 
exposed Alias aliasCountryName office.country.name 
exposed Alias aliasCountryFlag office.country.flag.flagPict

PROJECT EDITOR SIDE

All aliases created from the 4D side are displayed in the Structure section of your mobile project.

blank

Then you can use it like any other field in your mobile app creation process. This means that you can :

  • use an alias to filter your data from the Data section
  • use it as an action parameter from the Action section
  • assign it an icon, labels, and formatters from the Labels & Icons section
  • drop them in your list and detail templates as any other field depending on the alias type

 

blank

MOBILE APP SIDE

Here you can see, for example, that using aliases and flag pictures at the third level are directly available from the Employees tab in this Android app!

blank

So this new feature allows a more advanced usage of the existing templates and displays more relevant information, which will enable you to bring back to the first-level data available at different levels!

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

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.