Hi,
I want to retrieve multiple parent objects. assume I have two tables Auctions and Bids.
Bids has a column with Data Type ‘data relation’ and it relates to objects of Auctions.
I have objectId of Table Auctions and I want to retrieve all objects of Table Bids.
For better understanding I attached screenshot Please check
Is there a particular reason why you organized your relation that way? Specifically, why wouldn’t you want to have a 1:N relation column declared in the Auctions
table?
Hi @Ayaz_Khan,
you can try the following where-clause against Bids table:
aution.objectId = 'object-id-of-the-record-from-the-table-auctions'
Hi @stanislaw.grin,
I am not able to do this as I want to retrieve this in an existing query
let whereClause = `objectId != '${myObjectId}'`;
var queryBuilder = Backendless.DataQueryBuilder.create();
queryBuilder.addProperties("description", "first_name", "objectId", "status");
queryBuilder.setWhereClause( whereClause );
queryBuilder.setRelated( [ "auctions.charity","auctions.event_type", "charities"]);
queryBuilder.setGroupBy("objectId").setPageSize( pagging );
queryBuilder.setRelationsPageSize(100);
return await Backendless.Data.of( "Users" ).find( queryBuilder )
In this line
queryBuilder.setRelated( [ "auctions.charity","auctions.event_type", "charities"]);
I also want to get bids data of a particular auction.
You’re loading data from Users
. Are Bids
related to users in any way? If they are, you can load only related bids based on some criteria.
Hi @mark-piller,
Users add a bid on a particular Auction and one user can add a bid on multiple auctions.
I just want to fetch all Users’ all auctions and all bids of that auctions.
If there is a relationship from user to auctions and bids, you can retrieve related objects. The documentation clearly describes how to do it.