This is a migrated thread and some comments may be shown as answers.

One to many relations with Power Fields

1 Answer 54 Views
General Discussion
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Bruno
Top achievements
Rank 1
Bruno asked on 09 Aug 2013, 12:36 AM
When I have a one to many relation between my tables, which way is better to setup my tables' fields?

In this example I'm assuming a Users table where each user can have many phones from the Phones table:

Users has a phones "relation to many" field
Phones has a user "relation" field

I was wandering if I need to use both solutions to be able to use Power Fields where I can retrieve info from both the Users and Phones table.

1 Answer, 1 is accepted

Sort by
0
Lyubomir Dokov
Telerik team
answered on 09 Aug 2013, 08:06 AM
Hello Bruno,

For power fields you do not need to define relations. Power fields work in a different way, with them you can easily get related items even without them being defined as related in the data model. You can think of a power field definition like this:
Give me an additional field called "MyField" which contains all the items from "TypeA" that satisfy "my filter".
Power fields are generic apporach to fetch additional data in a single request and has nothing to do with relations.

Currently, when you specify a relation in the data model it is only used in the Everlive Backend Portal to present the items in a more convenient way (e.g. you are able to browse the linked items). In the future we plan to add an option to automatically "expand" related items, meaning that if you have defined a relation in the data model, you will not need to use power fields to get the related items.

In case you always want to get phones along with users, you may also consider making Phones an embedded array in the Users content type, not a standalone content type. This is also supported by Everlive.

I hope this clarifies things a bit. Let us know if you have any questions.

Regards,
Lyubomir Dokov
Telerik

Do you enjoy Icenium? Vote for it as your favorite new product here (use short code H048S).
Looking for tips & tricks directly from the Icenium team? Check out our blog!
Share feedback and vote for features on our Feedback Portal.
Tags
General Discussion
Asked by
Bruno
Top achievements
Rank 1
Answers by
Lyubomir Dokov
Telerik team
Share this question
or