Skip field names in foreach loop

Posts   
 
    
markm226
User
Posts: 9
Joined: 30-May-2013
# Posted on: 19-Aug-2014 07:44:17   

Running 4.2. I have a TDL template with a foreach loop. There are some known fields I am always wanting to skip. There are similar threads on the forum about skipping read-only fields when generating a DTO class. That almost works for me, but it also leaves out the identity PK values. Is it possible to check a field name, for example?

This isn't working, but hopefully shows what I am trying to do. If the current field name is "CreatedByUser" (which is one of the calculated fields I want to skip):

<[Foreach EntityField CrLf]> <[ If Not StringValueEquals EntityFieldName "CreatedUser" ]> toFill.<[EntityFieldName]> = _<[CaseCamel EntityFieldName]>; <[ EndIf]> <[NextForeach]>

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 19-Aug-2014 10:10:54   

Starting with v4, it's not recommended to use TDL templates anymore. If possible please rewrite it in .lpt templates where you have much more freedom what to do.

If that's not possible for this template (e.g. it's massive), please let us know.

Frans Bouma | Lead developer LLBLGen Pro