Current Field Index in Lpt

Posts   
 
    
Dja
User
Posts: 29
Joined: 22-Jul-2010
# Posted on: 12-Mar-2012 12:30:19   

Hi all,

I have a question regarding lpt templates. When I include a lpt template in tdl for each entity field, I need to generate current field index too.
There is no key value for current field index in activeObject hashtable. Can I pass it somehow to the lpt? I also tried to modify TDLInterpreter and add _foreachIndex to a hashtable, but i can't start code generation process when I replace TDLInterpreter.dll. I could write lpt to include it under current entity, instead of under current field, and iterate myself to generate current field index, but I don't know if that is the best way.

Can you help me finding the best way to do this? Tnx in advance.

Dja
User
Posts: 29
Joined: 22-Jul-2010
# Posted on: 12-Mar-2012 13:36:30   

I managed to do this the simplest way.


EntityDefinition entity = (EntityDefinition)((Hashtable)_activeObject)["CurrentEntity"];
IFieldElementCore field = (IFieldElementCore)((Hashtable)_activeObject)["CurrentEntityField"];

...

entity.Fields.IndexOf((FieldElement)field) + Convert.ToInt32(entity.IsSubType)

I hope this is a good way. Cheers.