One to many relations with Power Fields

2 posts, 0 answers
  1. Bruno
    Bruno avatar
    1 posts
    Member since:
    Oct 2012

    Posted 08 Aug 2013 Link to this post

    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.
  2. Lyubomir Dokov
    Admin
    Lyubomir Dokov avatar
    43 posts

    Posted 09 Aug 2013 Link to this post

    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.
Back to Top