Templates > Source Code (using TaggedValues) (#356)
I'm trying to access a specific class element tagged value.
Have tried the following but didn't return anything:
<%==SIM:ForEach:Element.TaggedValues==%><%==SIM:If:TaggedValue.Name=Parent==%>Property Parent<%==SIM:TaggedValue.Value==%> AS ci<%==SIM:TaggedValue.Value==%><%==SIM:EndIf==%><%==SIM:EndFor==%>
I couldn't find an example, do you have any suggestions on how to achieve this?
SJ 8 May 2014 6:16:46
Or should I be using Template Parameters for this purpose? Not sure how to use in a template.
Dusan Rodina - softwareideas.net 8 May 2014 7:14:26
The problem is in equal command, it should be 'Equals' instead of '='.
I corrected your code:
<%==SIM:ForEach:Element.TaggedValues==%><%==SIM:If:Equals(TaggedValue.Name,"Parent")==%>Property Parent<%==SIM:TaggedValue.Value==%> AS ci<%==SIM:TaggedValue.Value==%><%==SIM:EndIf==%><%==SIM:EndFor==%>
Here is the manual for the templates.
www.softwareideas.net/SIM_Templates_Manual.pdf
I will add the new articles about template language to Help section (www.softwareideas.net/en/help) soon.
SJ 8 May 2014 9:22:36
Thankyou for your super fast response. That worked a treat even though it is a bit long winded. Code generation is the main reason I purchased your software.
Thanks for the link above did end up finding it in a google search.
Looks like there is much more in the templates then documented.
Items of interest:
- Template Parameters how these are intended to be used
- Nested classes
- Include
I'm enjoying using your software, keep up the good work!!!
Dusan Rodina - softwareideas.net 11 May 2014 22:54:12
You're welcome!
Updated help for template language will be added soon to help section on this website.
SJ 8 May 2014 4:56:21
I've noticed that there could be GetTaggedValue() but not sure of it's Syntax.