Home
Help
Register
Log in

Search

 
   Active Threads  

You are here: Home > LLBLGen Pro > Custom Templates> ElementTargetObjectName and SourceColumnName for RelatedEntityField
 

Pages: 1
Custom Templates
ElementTargetObjectName and SourceColumnName for RelatedEntityField
Page:1/1 

  Print all messages in this thread  
Poster Message
alexdresko
User



Location:
Greenville, SC
Joined on:
08-Jun-2004 17:30:02
Posted:
336 posts
# Posted on: 20-Oct-2006 18:08:48.  
I've had a template created for a while that spits out an excel file containing four columns: Old Table Name, LLBL Entity Name, Old Field Name, and New Property Name... It's easier for some in our group to fire up this Excel file instead of LLBLGen for several reasons, but that's not important really..

Until now, the Excel file has never included fields mapped on related fields. I've got it half working, but ElementTargetObjectName unexpectedly returns the current entity table name and SourceColumnName unexpectedly returns an empty string.

Below are the relevant loops.. I can remove the Excel specific stuff if that makes it easier for you to read. The first inner loop outputs the standard entity fields and works fine For example:

Code:
AT197, ApplicantCertificationInformation, CSI32ID, CertificationCodeMasterId


The second loop outputs the related fields.. I want it to output something like

Code:
CR132, ApplicantCertificationInformation, mdesc, CertificationDescription (From Certification).


Instead, it outputs

Code:
AT197, ApplicantCertificationInformation, <blank>, CertificationDescription (From Certification)


(AT197 should be CR132 and <blank> should be mdesc... Also, <blank> is just a placeholder for an empty space to clarify the problem.)

Code:

<[Foreach Entity CrLf]>
<[Foreach EntityField IncludeInherited CrLf]>
<Row>
    <Cell><Data ss:Type="String"><[ElementTargetObjectName]></Data><NamedCell ss:Name="_FilterDatabase"/></Cell>
    <Cell><Data ss:Type="String"><[CurrentEntityName]></Data><NamedCell
     ss:Name="_FilterDatabase"/></Cell>
    <Cell><Data ss:Type="String"><[SourceColumnName]></Data><NamedCell ss:Name="_FilterDatabase"/></Cell>
    <Cell><Data ss:Type="String"><[EntityFieldName]><[If EntityFieldIsOverriden]><[If Not EntityFieldContainedInCurrentEntity]>_<[EntityFieldEntityName]><[EndIf]><[EndIf]></Data><NamedCell
     ss:Name="_FilterDatabase"/></Cell>
</Row>
<[NextForeach]>
<[Foreach RelatedEntityField ]>
<Row>
    <Cell><Data ss:Type="String"><[ElementTargetObjectName]></Data><NamedCell ss:Name="_FilterDatabase"/></Cell>
    <Cell><Data ss:Type="String"><[CurrentEntityName]></Data><NamedCell
     ss:Name="_FilterDatabase"/></Cell>
    <Cell><Data ss:Type="String"><[SourceColumnName]></Data><NamedCell ss:Name="_FilterDatabase"/></Cell>
    <Cell><Data ss:Type="String"><[MappedFieldNameRelatedField]> (From <[ MappedFieldNameRelation ]>)</Data><NamedCell
     ss:Name="_FilterDatabase"/></Cell>
</Row>
<[ NextForeach ]>
<[NextForeach]>


So, how do I get the real source table and field for a RelatedEntityField?
I'm not a player, I just code a lot.   Top
Otis
LLBLGen Pro Team



Location:
The Hague, The Netherlands
Joined on:
17-Aug-2003 18:00:36
Posted:
37375 posts
# Posted on: 21-Oct-2006 11:19:24.  
That's not implemented in TDL as that statement was never needed.

What you should do is write these kind of templates in .lpt templates. In .lpt templates you've the ability to read every element of the project object model, in TDL only the ones needed for the generated code.

.lpt templates are perhaps a bit more cumbersome to write, as tdl doesn't require a lot of debugging, but in these cases the lack of a complete statement set for TDL is limiting.

If you need help with which properties / elements to read to get the same as the TDL statements you used in the template, let me know.


Frans Bouma
LLBLGen Pro / ORM Profiler Lead Developer | Blog | Twitter
 
Top
Pages: 1  


Powered by HnD ©2002-2007 Solutions Design
HnD uses LLBLGen Pro

Version: 2.1.12172008 Final.