Auto Populate Linked Items in Content Item

I have two content items. One is a doctors profile and the other content item is doctors specialty. In the doctors profile I link the specialty content item (Linked Item) into the doctors profile. So lets Say Dr. Giedrimas has a "Family Medicine" specialty. (Picture ITEM 1 in enclosed document) Now what I would like is when I look at the Specialty content item "Family Medicine" Dr. Giedrimas should show up as a doctor that the Specialty "Family Medicine" is used in. Now I do see this on the right side of the "Family Medicine Specialty" under the header "USED IN"(Picture ITEM 2 in enclosed document) but I cannot access that list.

It would be nice to just use the KC SDK to retrieve the content item "Family Medicine" and display "Used In" doctors instead of retrieving all the doctors list and filter each one for "Family Medicine" since It would be more efficient to just retrieve the "Family Medicine" specialty data instead filtering through all the doctors. Anybody have any thoughts on this or perhaps it is possible?

Thanks,
Robert

Tagged:

Comments

  • JanL@kentico.com[email protected] Czech RepublicMember, Administrator, Kentico Staff admin

    Hello @robert.burr ,

    I assume that you use .NET SDK. To get doctors with the "Family Medicine" specialty, just use the ContainsFilter:

    var response = await DeliveryClient.GetItemsAsync<DoctorsProfile>(
      new ContainsFilter("elements.specialty", "family_medicine")
    );
    

    This will use the native filtering capabilities, without the need to fetch unnecessary data into your app's memory.

    I hope I didn't miss anything in your description. Just out of curiosity, do you have scenarios of back-references other than those doctor--specialty ones? You know, we always try to get a broader understanding of problems that our customers deal with.

    Jan

Sign In or Register to comment.