Portal Engine Questions on portal engine and web parts.
Version 6.x > Portal Engine > Add non-db field to document type for transformation View modes: 
User avatar
Member
Member
eric.savage-clyral - 8/24/2012 9:23:56 AM
   
Add non-db field to document type for transformation
I have created a document type and I'm looking to do an outer join to include some additional info to show on the transformation, to be used in a web part.

We have already created the web part with all its styles, using the Repeater, so I'm looking to modify the query that this repeater is using, so that we can add in the join.

How can I achieve this? I have fiddled with the selectdocuments query and the document type join view, but not luck.

User avatar
Member
Member
eric.savage-clyral - 8/24/2012 9:25:06 AM
   
RE:Add non-db field to document type for transformation
Just to be clear, the field I want to add is in another custom table.

User avatar
Certified Developer 8
Certified Developer 8
Jiveabillion - 8/24/2012 9:29:16 AM
   
RE:Add non-db field to document type for transformation
You can use the SQL datasource to query the view for your document type i.e. View_Custom_YourDocType_Joined and outer join that on your custom table.

Then you can use whatever transformation you like and will have access to all of the columns you return with your query.

User avatar
Kentico Legend
Kentico Legend
Brenden Kehren - 8/24/2012 9:31:52 AM
   
RE:Add non-db field to document type for transformation
I've done this for several dropdown list or combobox list selections. You would have to make the field a persistant field in your current document type but instead of storing a PK, store the text from the custom table.

For instance your CustomTable.Field2 has the data in it you want (text). CustomTable.Field1 is the primary key. In your custom documenttype, create a field that is a dropdown and then create a select query to gather the data from your CustomTable.
SELECT Field2 AS [Value], Field2 AS [Text] FROM CustomTable ORDER BY Field2

Then in your transformation to display, just reference the Field2 which should be storing the text from your CustomTable. Not the cleanest way, but it works. You could also write a Macro or method that gets that "name" based on an ID if you need to store the primary key, and the just reference either the macro or the method in your ascx file.

User avatar
Member
Member
eric.savage-clyral - 8/24/2012 9:56:16 AM
   
RE:Add non-db field to document type for transformation
Thanks for all the feedback.

Just to confirm, if the field is not on the document type, I can't use it in the transformation on that document type?

User avatar
Certified Developer 8
Certified Developer 8
Jiveabillion - 8/24/2012 10:21:47 AM
   
RE:Add non-db field to document type for transformation
You can use any transformation from any document type FOR any document type. They are really only associated with the document types for easy organization.

Obviously, you can't access fields in your transformation that aren't supplied to it. Just use the SQL Datasource and the Basic Repeater like I mentioned before. It will work, I promise.