Portal Engine Questions on portal engine and web parts.
Version 7.x > Portal Engine > Building WHERE clause macros for custom document types View modes: 
User avatar
Member
Member
kashank - 9/24/2013 3:12:24 PM
   
Building WHERE clause macros for custom document types
I have a pre-existing custom table that has many "items" in it. Each item has attributes that I'd like to pull into kentico pages. In an attempt to achieve this, I created a document type(foo) with a column of 'ItemID' and a query that selects from the previously mentioned custom table(which shares the same column) and implemented the ##WHERE## helper macro.

I then created a page template with a query repeater which utilizes my query.

If I create a new foo and manually enter the ItemID into the where clause in the query repeater I am given a list of attributes as expected. I am hoping to add a macro value into the WHERE clause of the page template, so that all of the attributes populate based off the foo's ItemID.

I thought doing something like:
{%CurrentDocument.DocumentCustomData["ItemID"]%}
would work, but all I get back is an empty string which will break my query.

How can I reference my documents "ItemID" using the macro builder?

User avatar
Member
Member
kentico_sandroj - 10/20/2013 12:19:59 PM
   
RE:Building WHERE clause macros for custom document types
Hello,

Would it be possible to provide the code for your template/repeater so that we can reproduce the setup? If you need the document ItemID in a Portal Engine template, you can use {%CurrentDocument.GetValue("ItemID")%}

Is that what you were wondering about? Please let me know if I misunderstood or if you have more information to provide.

Best Regards,
Sandro

User avatar
Kentico Legend
Kentico Legend
Brenden Kehren - 10/21/2013 7:17:06 AM
   
RE:Building WHERE clause macros for custom document types
Is there a particular reason you're using a doc type for a custom table item? You can simply create some page aliases and transformations and still get the same effect as you would if you were using a doc type. The only difference is you lose the "document" properties and statistics (and probably a few other minor items).

User avatar
Member
Member
vcarter - 10/21/2013 8:19:01 AM
   
RE:Building WHERE clause macros for custom document types
When I have had need of something like this(combining custom table data with document data), I have created a custom query and referenced the view_[doctype]_joined table and then linked that with my custom tables via SQL joins. This returns document information as well as document node information. Which allows you to keep your pages more in line with normal document tree operations.