Portal Engine Questions on portal engine and web parts.
Version 4.x > Portal Engine > Lookup values from another document type View modes: 
User avatar
Member
Member
ROBERT.FIELD-PRIDEICT - 6/15/2009 4:59:15 PM
   
Lookup values from another document type
I have created two new document types

custom_Leagues
custom_Teams

I have created a drop down field value within the teams table to allow the user to select a league when adding a new document of type team.

Leagues
1 Premiership League
2 Championship League

Teams
1 - A Team
2 - B Team
...

Now my question is that when I create the transition for the preview of the Team. I want to display the full league name "Premiership League", as when the data is saved it is normalised and the LeagueID field that I created in the Team table holds the value 1. Is there a function that can display the lookup value. At present all i get is the LeagueID displayed.

I tried to change the document select query to use a view called VCustom_Team, which joined the data together to bring back the League Name but it was still blank..????

Again I can find NO documentation to support my question. It must be possible otherwise why have the ability to lookup values in other tables. Should I be using bizforms to hold the data???

Please help getting very frustrated again... Much as I love this product the documentation and forum search facilities are very hard to work with.. I know the product is evolving all the time but I hate having to pose these simple questions in the forum...

User avatar
Kentico Support
Kentico Support
kentico_zdenekc - 7/7/2009 2:58:23 AM
   
RE:Lookup values from another document type
Hi Robert,

you've maybe solved this already, I'm very sorry for the delay...I might even have increased your frustration, let's hope following info will be still usefull.

Your solution with the view should be possible, however from the given information I cannot identify the cause.

The easiest and optimal solution is to use "Repeater with custom query".

I've created a simple scenario according to your description, two doctypes "Team" and "League", Team contains field TeamLeague linked to LeagueID field of League doctype. LeagueName field of League contains the desired name, which we want to display in transformation.

I've created new transformation for Team documenttype:

SELECT ##TOPN## ##COLUMNS##, LeagueName FROM custom_Team INNER JOIN custom_League ON TeamLeague = LeagueID WHERE ##WHERE## ORDER BY ##ORDERBY##

Then I set this query in Content / Query name property of Repeater with custom query and in the transformation, I use:

team name:
<%# Eval("TeamName") %>

team league id and name:
<%# Eval("TeamLeague") %>
<%# Eval("LeagueName") %>

--works fine for me.

Hope you will still find this helpful.
Please let me know if you need any further details.

Best regards,
Zdenek C.

User avatar
Member
Member
ROBERT.FIELD-PRIDEICT - 7/7/2009 9:25:05 AM
   
RE:Lookup values from another document type
Perfect answer..

I have applied this as described and it works fine. I think the post serves as a good example of how to extend the system and better understand what the Transaformation and custom queries can achieve.

Thank you...