Portal Engine Questions on portal engine and web parts.
Version 4.x > Portal Engine > trabsformation using doc type + customtable View modes: 
User avatar
Member
Member
eagleag - 9/1/2009 6:46:10 AM
   
trabsformation using doc type + customtable
Hi,

1. I have a document type which has a transformation that displays on my site (this is a product).

2. I created a custom table that you can update info throw cmsdesk->tools->Custom tables. Has 2 fields: ProductKashrut, ProductKashrutImage


In the transformation for document type I display some text that the admin chose from the FORM tab in cmsdesk, from a drop down list (is populated using sql query from custom table).
Kashrut - <%# Eval("ProductKashrut") %>


on the next line of the transformation I would like to display an image the goes with "ProductKashrut" but only exists in the custom table.
how can I connect the two?
Can I do something like this:

Kashrut - <%# Eval("ProductKashrut") %><br />
<%# (FIND ("ProductKashrutImage") FROM customtalbe_tableName WHERE ("ProductKashrut") = ("ProductKashrut")) %>






User avatar
Member
Member
seanbun-gmail - 9/1/2009 8:25:01 AM
   
RE:trabsformation using doc type + customtable
Go to your document type and create a query to join your document table and the custom table. Then, use a QueryRepeater to disaplay your image.

If you open the Kentico database and check the View folder, you would find a view like View_Namespace_custometable which you would probably find all fields you are looking for. You may join your custom table with this view.

Hope this makes sense to you.

Cheers,
Matt
@seanbun

User avatar
Kentico Developer
Kentico Developer
kentico_zbysekn - 9/1/2009 8:54:11 AM
   
RE:trabsformation using doc type + customtable
Hi,
well you can also create custom transformation function(Custom transformation function) which will connect the data together, but the solution suggested by seanbun should be much more effective.
Best Regards,
Zbysek Nemec.

User avatar
Member
Member
eagleag - 10/7/2009 10:50:06 AM
   
RE:trabsformation using doc type + customtable
Hi,
I created a query in the document type that should connect between the doc type and the custom table.

this is the query:

SELECT ProductImage
FROM customtable_name WHERE ProductImage = KashrutType


this a the sql for a drop down list that when the user selects one of the options I want to automatically connect it to an image from the customTable

SELECT KashrutType, KashrutType
FROM customtable_kashrutType


I cant use a query repeat because I need this image to display ,in the design, as part of the product transformation.
Is thre an code I can write in the transformation that will get info directly from a query?


User avatar
Kentico Developer
Kentico Developer
kentico_ondrejv - 10/15/2009 1:08:00 AM
   
RE:trabsformation using doc type + customtable
Hello,

If you want to get value from the database in the transformation, you can create custom function: http://devnet.kentico.com/docs/devguide/adding_custom_functions_to_transformations.htm containing the code to run custom query. You can use your created query for that purpose. Please find how to call custom query: http://devnet.kentico.com/docs/devguide/data_layer_code_examples.htm.

I believe it is what you need.

Best Regards
Ondrej Vasil