Go further with Object fields

Automatically translated from English

Object fields introduced with v15 allows unstructured data bases, similar to schemaless database (NoSQL). 4D v16 goes a big step further. Get a dynamic structure for unstructured data… Confused?

Imagine you use an object field to allow your customers to store custom data, where they can create their own fields. This works well and is one of the most interesting reasons for using an object field. The problem is, how to allow your customer to query this unstructured data? You don’t know which ‘fields’ they used, you cannot build a query editor on top or offer a drop down with used values.

With 4D v16 it is now possible using the two new commands DISTINCT ATTRIBUTE PATHS and DISTINCT ATTRIBUTE VALUES.

  • If you want to know all the existing attributes your user could have entered, in order to display them in a popup for example, you can use the DISTINCT ATTRIBUTE PATHS command. This command returns the list of distinct paths found in your indexed object field for the current selection.
  • You can also use the DISTINCT ATTRIBUTE VALUES command if you want to know all the existing and non-repeated values in a defined path in order to present them, for example, in a list. This command returns the distinct values coming from a defined path in your indexed object field for the current selection.

In addition, standard mathematical functions have been upgraded so that they can be used with object fields:

  • Sum
  • Min
  • Max
  • Average

 

Example
If you want to see an example, please take a look at this example.

Database Example 

hdi_distinctFor more details, please refer to the 4D v16 documentation, in the following articles:

Caroline Briaud

• 4D Product Team Leader •

Caroline joined 4D SAS in July, 2013 as an Engineering Manager responsible for new features definition. Caroline helped the Engineering team to put in place the R-release concept, with the new development process definition and its application within 4D’s engineering teams.Caroline is now leading the 4D Product team, mainly made up of Product Owners which are representing the customers within Engineering.

Caroline started her career as a software developer in the mobile phone industry. She specialized in program management with an American company in an international context spread across US, India and China.