Posted on 20/12/2016 08:56:17
Hi Nicolai
I have simplified my code a bit, so now it looks like this:
var loopname = "Rulings";
foreach (var option in GetLoop("Item." + loopname + ".Options"))
{
<text>In loop<br/></text>
}
Now when running this code there are no items in the loop. But if I add @TemplateTags() like this:
var loopname = "Rulings";
@TemplateTags()
foreach (var option in GetLoop("Item." + loopname + ".Options"))
{
<text>In loop<br/></text>
}
the loop contains items. The same happens if the code looks like this:
var loopname = "Rulings";
//foreach (var option in GetLoop("Item.Rulings.Options"))
foreach (var option in GetLoop("Item." + loopname + ".Options"))
{
<text>In loop<br/></text>
}
TemplateTags() output this:
Global.PageId |
System.Int32 |
3059 |
Global.PagingPosition |
System.Int32 |
1 |
Global.ParagraphId |
System.Int32 |
3074 |
Item.Field.First |
System.Boolean |
False |
Item.Field.Last |
System.Boolean |
True |
Item.Heading |
System.String |
Link liste |
Item.Heading.IsRequired |
System.Boolean |
False |
Item.Heading.Name |
System.String |
Overskrift |
Item.Heading.SystemName |
System.String |
Heading |
Item.Heading.Type |
System.String |
Text |
Item.Heading.Value |
System.String |
Link liste |
Item.Id |
System.String |
1 |
Item.Id.IsRequired |
System.Boolean |
False |
Item.Id.Name |
System.String |
Id |
Item.Id.SystemName |
System.String |
Id |
Item.Id.Type |
System.String |
Text |
Item.Id.Value |
System.String |
1 |
Item.ItemInstanceType |
System.String |
|
Item.ItemInstanceType.IsRequired |
System.Boolean |
False |
Item.ItemInstanceType.Name |
System.String |
ItemInstanceType |
Item.ItemInstanceType.SystemName |
System.String |
ItemInstanceType |
Item.ItemInstanceType.Type |
System.String |
Text |
Item.ItemInstanceType.Value |
System.String |
|
Item.ItemTypeName |
System.String |
Ruling |
Item.ItemTypeName.IsRequired |
System.Boolean |
False |
Item.ItemTypeName.Name |
System.String |
Indholdstype |
Item.ItemTypeName.SystemName |
System.String |
ItemTypeName |
Item.ItemTypeName.Type |
System.String |
Radio button list |
Item.ItemTypeName.Value |
System.String |
Ruling |
Item.ParagraphHeader |
System.String |
Link liste |
Item.ParagraphHeader.IsRequired |
System.Boolean |
False |
Item.ParagraphHeader.Name |
System.String |
ParagraphHeader |
Item.ParagraphHeader.SystemName |
System.String |
ParagraphHeader |
Item.ParagraphHeader.Type |
System.String |
Text |
Item.ParagraphHeader.Value |
System.String |
Link liste |
Item.ParagraphName |
System.String |
Link liste |
Item.Rulings |
System.String |
|
Item.Rulings.IsRequired |
System.Boolean |
False |
Item.Rulings.Name |
System.String |
Afgørelser |
Item.Rulings.SystemName |
System.String |
Rulings |
Item.Rulings.Type |
System.String |
Checkbox list |
Item.Rulings.Value |
System.String |
|
Item.Sort |
System.String |
1 |
Item.Sort.IsRequired |
System.Boolean |
False |
Item.Sort.Name |
System.String |
Sort |
Item.Sort.SystemName |
System.String |
Sort |
Item.Sort.Type |
System.String |
Text |
Item.Sort.Value |
System.String |
1 |
Item.SystemName |
System.String |
LinkList |
Item.Text |
System.String |
|
Item.Text.IsRequired |
System.Boolean |
False |
Item.Text.Name |
System.String |
Tekst |
Item.Text.SystemName |
System.String |
Text |
Item.Text.Type |
System.String |
Rich text |
Item.Text.Value |
System.String |
|
ParagraphContainer |
System.String |
content |
ParagraphContainerCount |
System.Int32 |
2 |
ParagraphContainerIsFirst |
System.Boolean |
True |
ParagraphContainerIsLast |
System.Boolean |
False |
ParagraphContainerSort |
System.Int32 |
1 |
ParagraphGlobalID |
System.Int32 |
0 |
ParagraphHeader |
System.String |
Link liste |
ParagraphID |
System.Int32 |
3074 |
ParagraphImage |
System.String |
|
ParagraphImageClean |
|
|
ParagraphImageHAlign |
System.String |
left |
ParagraphImageHeight |
System.Int32 |
0 |
ParagraphImageLinkAlt |
System.String |
|
ParagraphImageLinkClean |
System.String |
|
ParagraphImageLinkTarget |
System.String |
|
ParagraphImageVAlign |
System.String |
top |
ParagraphImageWidth |
System.Int32 |
0 |
ParagraphModule |
System.String |
|
ParagraphPageID |
System.Int32 |
3059 |
ParagraphText |
System.String |
|
Setting.items-allowed |
System.String |
Article, TwoColLinkList, LinkList |
Template:BaseUrl |
System.String |
/Files/Templates/Designs/Boligjura/Paragraph/ |
Template:DesignBaseUrl |
System.String |
/Files/Templates/Designs/Boligjura/ |
Loops |
|
Item.Groups |
|
Item.Fields |
|
Item.ItemTypeName.Options |
|
Item.Rulings.Options |
Global.PageId |
System.Int32 |
3059 |
Global.PagingPosition |
System.Int32 |
1 |
Global.ParagraphId |
System.Int32 |
3074 |
Item.Field.First |
System.Boolean |
False |
Item.Field.Last |
System.Boolean |
True |
Item.Heading |
System.String |
Link liste |
Item.Heading.IsRequired |
System.Boolean |
False |
Item.Heading.Name |
System.String |
Overskrift |
Item.Heading.SystemName |
System.String |
Heading |
Item.Heading.Type |
System.String |
Text |
Item.Heading.Value |
System.String |
Link liste |
Item.Id |
System.String |
1 |
Item.Id.IsRequired |
System.Boolean |
False |
Item.Id.Name |
System.String |
Id |
Item.Id.SystemName |
System.String |
Id |
Item.Id.Type |
System.String |
Text |
Item.Id.Value |
System.String |
1 |
Item.ItemInstanceType |
System.String |
|
Item.ItemInstanceType.IsRequired |
System.Boolean |
False |
Item.ItemInstanceType.Name |
System.String |
ItemInstanceType |
Item.ItemInstanceType.SystemName |
System.String |
ItemInstanceType |
Item.ItemInstanceType.Type |
System.String |
Text |
Item.ItemInstanceType.Value |
System.String |
|
Item.ItemTypeName |
System.String |
Ruling |
Item.ItemTypeName.IsRequired |
System.Boolean |
False |
Item.ItemTypeName.Name |
System.String |
Indholdstype |
Item.ItemTypeName.SystemName |
System.String |
ItemTypeName |
Item.ItemTypeName.Type |
System.String |
Radio button list |
Item.ItemTypeName.Value |
System.String |
Ruling |
Item.ParagraphHeader |
System.String |
Link liste |
Item.ParagraphHeader.IsRequired |
System.Boolean |
False |
Item.ParagraphHeader.Name |
System.String |
ParagraphHeader |
Item.ParagraphHeader.SystemName |
System.String |
ParagraphHeader |
Item.ParagraphHeader.Type |
System.String |
Text |
Item.ParagraphHeader.Value |
System.String |
Link liste |
Item.ParagraphName |
System.String |
Link liste |
Item.Rulings |
System.String |
|
Item.Rulings.IsRequired |
System.Boolean |
False |
Item.Rulings.Name |
System.String |
Afgørelser |
Item.Rulings.SystemName |
System.String |
Rulings |
Item.Rulings.Type |
System.String |
Checkbox list |
Item.Rulings.Value |
System.String |
|
Item.Sort |
System.String |
1 |
Item.Sort.IsRequired |
System.Boolean |
False |
Item.Sort.Name |
System.String |
Sort |
Item.Sort.SystemName |
System.String |
Sort |
Item.Sort.Type |
System.String |
Text |
Item.Sort.Value |
System.String |
1 |
Item.SystemName |
System.String |
LinkList |
Item.Text |
System.String |
|
Item.Text.IsRequired |
System.Boolean |
False |
Item.Text.Name |
System.String |
Tekst |
Item.Text.SystemName |
System.String |
Text |
Item.Text.Type |
System.String |
Rich text |
Item.Text.Value |
System.String |
|
ParagraphContainer |
System.String |
content |
ParagraphContainerCount |
System.Int32 |
2 |
ParagraphContainerIsFirst |
System.Boolean |
True |
ParagraphContainerIsLast |
System.Boolean |
False |
ParagraphContainerSort |
System.Int32 |
1 |
ParagraphGlobalID |
System.Int32 |
0 |
ParagraphHeader |
System.String |
Link liste |
ParagraphID |
System.Int32 |
3074 |
ParagraphImage |
System.String |
|
ParagraphImageClean |
|
|
ParagraphImageHAlign |
System.String |
left |
ParagraphImageHeight |
System.Int32 |
0 |
ParagraphImageLinkAlt |
System.String |
|
ParagraphImageLinkClean |
System.String |
|
ParagraphImageLinkTarget |
System.String |
|
ParagraphImageVAlign |
System.String |
top |
ParagraphImageWidth |
System.Int32 |
0 |
ParagraphModule |
System.String |
|
ParagraphPageID |
System.Int32 |
3059 |
ParagraphText |
System.String |
|
Setting.items-allowed |
System.String |
Article, TwoColLinkList, LinkList |
Template:BaseUrl |
System.String |
/Files/Templates/Designs/Boligjura/Paragraph/ |
Template:DesignBaseUrl |
System.String |
/Files/Templates/Designs/Boligjura/ |
Loops |
|
Item.Groups |
|
Item.Fields |
|
Item.ItemTypeName.Options |
|
Item.Rulings.Options |