4D for iOS: Sort criteria and action parameters enhancements

4D for iOS gives you the ability to define actions that automatically call a 4D method linked with an event on the smartphone. For example, using them, you can execute 4D code, manage and edit your app’s content using parameters, and, more recently, sort your app’s content easily using sort actions!

Defining sort criteria and action parameters has been improved to make things easier and help you work more quickly and efficiently.

Action parameters

As you probably know, 4D for iOS offers various types of preset actions to ease your development process:

  • Add
  • Edit
  • Delete
  • Share
  • Sort

So what’s new?

Sort Criteria

Regarding the Sort action, you can now easily change action sort criteria using a simple dropbox. This enables you to choose another field among the available ones:


linking action parameters to FIELDS

For the Add… and Edit… preset actions, at the bottom of the Action Parameters panel, a message indicates when a parameter is linked to an existing field:


Why link action parameters to FIELDS?

By linking your parameters to your fields, the MobileAppServer component can help you simplify your 4D code in your On Mobile App Action database method.

As a reminder, the MobileAppServer component, which is built in 4D, gives you access to various utility methods to speed up your 4D mobile app backend coding.

In our case, it will allow you to get a dataClass or entity using generic code, and map parameters and fields generically. So there’s no need to write specific code anymore!

Here is an example of the On Mobile App Action that you can get using the Add preset action and the MobileAppServer component :

#DECLARE($request : Object)->$response : Object
$response:=New object("success"; False)

Case of 
 : ($action.name="addEmployees") // add@

  var $entity; $status : Object
  $status:=$entity.save()  // save the entity

  If ($status.success)
    $response.success:=True  // notify App that action success
    $response.dataSynchro:=True  // notify App to refresh the selection
    $response.statusText:="Employee added"
    $response.statusText:="Failed to add"  // $status.statusText
  End if 
End case 

As a reminder, to add linked parameters to the field, click on the plus button arrow located at the bottom of the action parameter’s panel:


And you are still free to create parameters that do not have representation in your database, by clicking on the New parameter item from the menu.

Starting with v19 R3, you can edit and link/unlink an action parameter by changing its name: 4D for iOS detects automatically if the name of a parameter corresponds to an existing field name. And best of all, 4D for iOS helps with autocompletion and tells you which fields are available and linked with your parameter. Once it is linked, all the parameter properties are automatically adapted depending on the linked field type.



For those who were already using actions, all your logic is, of course, preserved.

This feature looks very simple, but I can fully guarantee that it will make your 4D for iOS app creation process much more pleasant!

Feel free to comment on the 4D forum, and check the dedicated 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.