This is hopefully an easy question that just needs to be made obvious in the documentation…
Consider the following example data object:
public class ExampleRoot
{
public DateTime MainDate { get; set; }
public List<ExampleChild> ExampleChildren { get; set; }
}
public class ExampleChild
{
public string Name { get; set; }
public DateTime ChildSpecificDate { get; set; }
}
And the following example template:
Report Document For
<<[MainDate]:"MMMM d, yyyy">>
<<foreach [in ExampleChildren]>>
<<[Name]>>
<<if [ChildSpecificDate != MainDate]>>
(<<[ChildSpecificDate]>>
)<</if>>
<</foreach>>
This obviously doesn’t work, because the scope inside the foreach is an ExampleChild
object which doesn’t have a MainDate
.
I do know that if I have nested foreaches, I can access the outer foreach by naming its iteration variable:
<<foreach
[folder
in folders]>>
Folder<<[FolderName]>>
<<foreach [in files]>>
<<[FileName]>>
in<<[folder.FolderName]>>
<</foreach>>
<</foreach>>
Is there a mechanism like that for accessing the root of the data like I need to do above?