Support Topics Documentation Slack YouTube Blog

Restricting fields when loading related data

I’m fetching a set of records from a master table together with the associated data captured as 1:n relational columns. I’m using:

query.setRelationsDepth( 1 );
Backendless.Data.of("MASTERTABLE").find(query);

As expected, I’m getting a nested array, where the deep arrays contain data from the related table. All works fine.

My question is: is there a way to restrict the properties transported from the related table? Something like query.setProperties() but now for the associated table.

Regards,

Hello @Klaas_Klever

Are this part of the documentation answer on your querstion?

Regards, Dima

Hello @Dima_Vak ,
Thanks for this hint. It basically works! Some things I found:

  • I cannot use this in conjunction with query.setRelationsDepth(): But that’s ok. I only need a depth of 1.
  • The response now is de-normalized. The relation table is not represented an array within the array datasets from the primary table. The datasets from the primary table are now repeated for each dataset in the relational table. But I will be able to cope with that.

Thanks