Announcement

Collapse
No announcement yet.

Getting the value of a field through a related entity

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Getting the value of a field through a related entity

    Good afternoon I have problems getting field value through related entities.
    I have next structure: Brand has One-to-Many Relation with Product. Product has One-to-Many Relation with Model. Model has One-to-Many Relation with Modification. I want to display Product.name and Brand.name in my Modification entity, but I can display only model's fields. How can I get product's fields and brand's fields in my modification entity?

  • #2
    Hi VladZP,

    If you used the default Product and ProductBrand entities, with such relationships, you will only need to complete the following steps:
    1. Go to Administration > Entity Manager > Modification > Fields and create a Varchar type field called productName (you can choose whatever label you like, the main thing is to use this field name, because it will be used in the formula).
    2. Go to Administration > Entity Manager > Modification > Fields and create a Varchar type field called brandName (you can choose whatever label you like, the main thing is to use this field name, because it will be used in the formula).
    3. Go to Administration > Entity Manager > Modification > Layouts and transfer the previously created fields to those layouts where you want the product name and brand name to be displayed.
    4. Go to Administration > Entity Manager > Modification > Formula and paste the following lines:
      Code:
      	productName = model.productName;
      	brandName = record\attribute('Product', model.productId, 'brandName');​
    After that, try to create some test records with the Modification entity type and check the performance of my solution. Keep in mind that field values will only change after creating or updating records with the Modification entity type. That is, if you unlink a brand from a product, its name will still be displayed in the Modification record until you change the value of any field in this record.

    Please let me know if you have any problems with this solution or need to change anything.​

    Comment

    Working...
    X