Portal Engine Questions on portal engine and web parts.
Version 6.x > Portal Engine > Getting fields from documents in web parts View modes: 
User avatar
Member
Member
Armysniper89 - 7/13/2012 9:03:54 PM
   
Getting fields from documents in web parts
I have a field I have added to the Article document type that is an integer value (an index into a custom lookup table). It allows my content authors associate a value with a value used in our job board. I am creating a web part that looks up the latest jobs that match the field in the article. How can the value of this field in the Article document type on a web part that is located in the side bar of the page the Article is being displayed in?

User avatar
Certified Developer 8
Certified Developer 8
Jiveabillion - 7/14/2012 12:20:16 AM
   
RE:Getting fields from documents in web parts
CMSContext.CurrentDocument["YOURFIELDNAME"]

User avatar
Member
Member
Armysniper89 - 7/16/2012 9:04:33 PM
   
RE:Getting fields from documents in web parts
Instead of creating a separate web part, I am trying to use a Custom Table Repeater and setup the "Where" clause to filter by the value in the current document by the field *IF* it has a value in the field (greater than 0)...so CMSContext is not available...ideas?

User avatar
Member
Member
Armysniper89 - 7/16/2012 9:04:34 PM
   
RE:Getting fields from documents in web parts
Instead of creating a separate web part, I am trying to use a Custom Table Repeater and setup the "Where" clause to filter by the value in the current document by the field *IF* it has a value in the field (greater than 0)...so CMSContext is not available...ideas?

User avatar
Member
Member
Armysniper89 - 7/16/2012 9:51:12 PM
   
RE:Getting fields from documents in web parts
I tried code like this in the "Where" clause field of the "Custom Table Repeater" but this did not work at all.. (first time in K#) ideas?


{%string whereClause = ""%}
{%if (CurrentDocument["RelatedJobBoardDomain"] > 0){ whereClause == whereClause + "DomainID = '" + CurrentDocument["RelatedJobBoardDomain"] + "'"}%}

User avatar
Kentico Support
Kentico Support
kentico_jurajo - 7/17/2012 5:58:28 AM
   
RE:Getting fields from documents in web parts
Hi,

Since you are using the custom table repeater, the document columns are not available. I would recommend using the repeater with custom query - you will create the query to get the data from a custom table according your needs and custom WHERE condition.

Best regards,
Juraj Ondrus

User avatar
Member
Member
Armysniper89 - 7/17/2012 11:45:23 AM
   
RE:Getting fields from documents in web parts
OK I think I got this working in my own web part that uses the ASP.NET repeater control. I have properties for the web part for passing in the query values. How can I in the web part properties set up for this control...pass the values stored within the Article automatically? Each article has a drop down list that stores the type of job. It is an integer value that I am storing as it is a lookup into a table in SQL. How can I get that value from the current document outside of CODE and in the properties for the web part?

User avatar
Member
Member
Armysniper89 - 7/17/2012 1:41:37 PM
   
RE:Getting fields from documents in web parts
I figured it out...:) I set the properties of my web part by using this syntax in the web part's properties.

{%CurrentDocument["RequiredJobType"]%}