Skip to content

Inverted Relation Retrieval

Backendless supports a special query syntax for loading a subset of child objects for a specific parent. Consider the following table schemas:

PhoneBook table:

phonebook-table-schema

Contact table:

contact-table-schema

Address table:

address-table-schema

These tables will be used to demonstrate how to query Backendless for conditional related object retrieval.

The general structure of a whereClause query to load a collection of child objects for a specific parent object is:

ParentTableName[ relatedColumnName ].parentColumnName COLUMN-VALUE-CONDITION

Both columns relatedColumnName and parentColumnName must be declared in a table with name of ParentTableName. The relatedColumnName must be a relation column. The table relatedColumnName points to is the table where the objects must be loaded from.

Codeless Reference

The following example is identical to the one presented above and uses the following condition in thewhere clause property: This operation is set to retrieve related objects using the age properties whose values is greater than 21, and also the city properties whose value is 'Tokyo'.

PhoneBook[contacts].objectId = 'DB7A04FD-C305-4615-8480-BF75F244F10F' and age > 21 and address.city = 'Tokyo'

data_inverted_relation_retrieval

After the Codeless logic runs, the operation returns only one object matching the where clause condition.

data_inverted_relation_retrieval_6