Portal Engine Questions on portal engine and web parts.
Version 7.x > Portal Engine > Managing Documents View modes: 
User avatar
Member
Member
hannahs-attunix - 8/16/2013 12:45:23 PM
   
Managing Documents
Hello,

We have a large number of files (actual files such as PDF, .xlsx, .docx) that we want to centrally manage in one folder. We would like to associate some metadata to these documents (i.e. document owner and related products).

Based on this metadata, we want to display a small subset of files on our different product pages.

At the moment, we have created a custom document type with additional fields for our metadata. We are attempting to display the appropriate files on a product page, when IDs match in both the file's metadata and the custom fields in our product document type. We have so far been unsuccessful in getting this to work.

(Using the "related documents" functionality is not an option as it is extremely user unfriendly for a user to identify up to 9 or 10 related products each for over 500 different files. For us, just to add the related documents for one file would require up to 70 clicks).

My questions are:
Is there a better way to do this?
Is there a way to programmatically add related docs based on data entered in custom fields by the user when the document type is created?

Thanks!
Hannah

User avatar
Kentico Support
Kentico Support
kentico_filipl - 8/17/2013 8:37:19 AM
   
RE:Managing Documents
Hello Hannah,

I believe that using API to add multiple related documents at once would be a flexible way of avoiding numerous amount of clicks which would be required if you decided to use UI.

Useful API examples for creating relationships between documents can be found in Developer's Guide - Managing relationships.

As for getting a custom field value in code, here is a sample code which you can use:
// Create an instance of the Tree provider first
TreeProvider tree = new TreeProvider(CMSContext.CurrentUser);

// Get the document
TreeNode node = tree.SelectSingleNode(CMSContext.CurrentSiteName, "/API-Example/My-new-document", "en-us");

// Get custom field value
String metadata = node.GetValue("metadataField");

// Custom logic for creating relationships
if (metadata == "something")
{
...
}

A complete list of all API methods is in API Reference.

Best regards,
Filip Ligac

User avatar
Member
Member
hannahs-attunix - 8/19/2013 5:39:52 PM
   
RE:Managing Documents
Thanks very much for the response. We decided to leverage macros which solved our problem.