How do you create a relationship between a user and the objects they have added?

I am building a gas tracking application, and I have a vehicle object which contains multiple mpg objects, and I want to make it so that every user can have their own vehicles with their own gas mileage data. What is the best way to approach this being that a user can have multiple vehicles and the vehicles can have multiple mpgs? I have attached my data models as they are currently. Thank you for any help.

export_2017_05_09_07_49_33.zip (776B)

Hi Jacob,

There is an API for creating a relationship between the parent and child objects:

Android: https://backendless.com/docs/android/doc.html#data_relations_api_set_add_android
iOS: https://backendless.com/docs/ios/doc.html#data_relations_api_set_add_ios
JS: https://backendless.com/docs/js/doc.html#data_relations_api_set_add_js

Regards,
Mark

Thank you very much for your response, The one issue that I am having is when trying to use the addRelation functionality I get this error:

Value of type 'IDataStore' has no member 'addRelation'

Please make sure you are using version 4 of the SDK. Do you develop with Android or iOS?

I develop with iOS and hadn’t updated to version 4, thank you!

The easiest way for setting up a project for 4.x is described in the quick start guide:

https://backendless.com/docs/ios/doc.html#quick_start_guide

backendlessuser with addrelation ?? plz

Hello,

please create separate topic and describe your problem

Hello, my problem is to add relation declared in backendlessuser table : backemdless.data.of(backendlessuser.class)…