Portal Engine Questions on portal engine and web parts.
Version 6.x > Portal Engine > Selected Item Transformation with query datasource View modes: 
User avatar
Member
Member
jheavner-ce - 3/19/2012 9:51:02 AM
   
Selected Item Transformation with query datasource
I am using a Query Datasource and a Basic repeater. I have a Transformation that displays some basic information and then I'm trying to use a Selected Item Transformation to show more detail using the GetDocumentUrl(). The Selected Item Transformation does not render even though the URL does change. It's always using the Transformation and not the Selected Item Transformation. How do I make this work?

User avatar
Kentico Support
Kentico Support
kentico_jurajo - 3/20/2012 4:42:06 AM
   
RE:Selected Item Transformation with query datasource
Hi,

The selected item transformation is used when you are on that selected item transformation. For example you have something like this:

News list page (transformation is used)
----news1
----news2

The selected item transformation is used when you actually are on news1 or news2 item.

I hope it makes sense.

Best regards,
Juraj Ondrus

User avatar
Member
Member
jheavner-ce - 3/20/2012 11:29:11 AM
   
RE:Selected Item Transformation with query datasource
That's exactly what I have. I have a custom DocType of Person that I use to extend data in the Users table. I understand that I can add custom fields to the Users table (and I have) but sometimes there's data that isn't applicable to all users or needs to be used in place of the data in the users table. My Person DocType has a UserName field that matches the UserName field in the Users table. I then extend the Person DocType to specific types of Persons that have unique characteristics.

To join my docType back to the Users table I have a custom query. That part works and is fine and it has all the data I want. I use a basic repeater and tie it to a datasource with my custom query. On my Item Transformation I display basic user info, on my selected item transformation I want to display extended user info. All of this information is in my custom query. Using GetDocumentUrl() I am able to generate a link that directs to my selected item. However, the Selected Item transformation is never called.


So using your example above.

People page (transformation is used)
---Person 1
---Person 2
---Person 3

Those are all documents and I can click and get to them so my url looks like /People/Person1.aspx but the Selected Transformation does not render. It always uses the Item Transformation.

I could do this without a custom query and just use a repeater on the DocType and then use custom functions and GetUserInfo to resolve all of the fields. However, that seems like it would be a database lookup on every field and that doesn't seem very efficient when I can issue one query call and get all my data.

Please advise.

User avatar
Kentico Support
Kentico Support
kentico_jurajo - 3/21/2012 6:15:08 AM
   
RE:Selected Item Transformation with query datasource
Hi,

It depends which data source are you using. You need to tell the data source that you are working with the selected item. This is available only for documents data source web part, property called "Enable selected item".

So, in your case, for the detail page I would use the document data source web part with this property enabled.

Best regards,
Juraj Ondrus

User avatar
Member
Member
jheavner-ce - 3/21/2012 11:56:04 AM
   
RE:Selected Item Transformation with query datasource
The fields I need are not in the document. The document contains an ID which I then use to look up information in the user table. I cannot use a document datasource because it will not pull the lookup fields I need to pull and it does not allow me to specify a query to use.

I'm using a query data source with a basic repeater. I mentioned that in my post. I understand how documents and repeaters work. My request is a bit more complicated than that.

What I'm trying to do seems like it would be a pretty common use case.

User avatar
Kentico Support
Kentico Support
kentico_jurajo - 3/22/2012 2:10:23 AM
   
RE:Selected Item Transformation with query datasource
Hi,

Well, I have not seen such a request or way of doing it this way before :-)

Mostly they are using the profile pages with wild card URLs and are adding custom fields to the users tables and then use the profile web parts to display them.

The way you are doing it is very complicated and the selected item transformation won't work since the data source does not know about it. You still can develop your own data source web part which will handle the selected items situation.

Best regards,
Juraj Ondrus