Android
Do you have an actual value for guest_id
so we can test what objects are returned from the Following
table?
Iād like to make sure we get actual objects using Backendless Console
The Id am supposed to receive is the users objectId but it isnāt. Eg. Id - E4B2D43E-B95A-EB4A-FFF4-05FC436CFE00
Sorry, I didnāt understand. What is this ID?
The guest object_id. That an sample of what am supposed to receive from the Users table to relate to Following table in a column guest_id. So onclick of it (the Id)directs me to that guest user object in the Users table.
If I understood you correctly you have that value the guest_id
column in the Following
table. Is that correct?
Do this just to check:
- Open Backendless Console
- Switch to the Data section
- Select the
Following
table - Enter this in the search bar:
guest_id = 'E4B2D43E-B95A-EB4A-FFF4-05FC436CFE00'
Do you get any objects back?
no. No data to display.
No the value isnāt in the guest_id column of Following table yet. That I copied from the Users table showing what am supposed to see.
I just tried something different now. I deleted the guest_id on the Following table now and created it again but this time made It a string and not an object reference. And what I wanted worked right how I wanted it. But the problem is the guest_id now is a strong so I canāt directly reach the userās data on the Users table, I will have to copy the string guest_id and now find it in the Users table.
I am getting all confused with the information you provide. So I will basically reiterate what the docs say:
This is the code to create a relation. You need to put the right values in here such as:
-
objectId
of the parent object - name of the column in the
Following
table (the code below shows it ascolumnNameInFolloring
- where clause to identify the children
HashMap<String, Object> parentObject = new HashMap<String, Object>();
// the value here MUST BE the objectId of the User object which is the "parent"
parentObject.put( "objectId", "41230622-DC4D-204F-FF5A-F893A0324800" );
Backendless.Data.of( "Users" ).setRelation( parentObject,
"columnNameInFolloring:Following:n",
"WHERE CLAUSE TO IDENTIFY THE CHILDREN",
new AsyncCallback<Integer>()
{
@Override
public void handleResponse( Integer response )
{
Log.i( "MYAPP", "relation has been set" );
}
@Override
public void handleFault( BackendlessFault fault )
{
Log.e( "MYAPP", "server reported an error - " + fault.getMessage() );
}
} );
The where clause here is referring to what table.
To the table where the child objects are.
Finally got it. Tanx Mark