How to total and display values from child pages by month
Hi,
Just new to the forum and im looking for a bit of guidance. I have a reports container page and which shows a grid of data with values of links to child pages. What I am trying to do is calculate the totals by month and display a tile that shows the total for each month. I have attached a screenshot of the page and also my partial view macro. I can get the values to add up but not by month. Any help or guidance would be greatly appreciated.
@inherits Umbraco.Web.Macros.PartialViewMacroPage
@{
int MonthlyCatchTotal = 0;
string sMonth = DateTime.Now.ToString("MMM");
//Fetch the blogposts from a certain node id
var latestCatches = Umbraco.Content(1157);
foreach (var childPage in latestCatches.Children.Where("Visible").GroupBy)
{
int total = childPage.totalFish;
MonthlyCatchTotal = MonthlyCatchTotal + total;
<div class="dashboard-tile">
<div class="dashboard-heading">
<div class="row">
<div class="col-xs-3">
<i class="fa fa-folder-open fa-5x"></i>
</div>
<div class="col-xs-9 text-right">
<div class="huge">@MonthlyCatchTotal</div>
<div>Total Catches @sMonth</div>
</div>
</div>
</div>
<a href="">
<div class="panel-footer">
<span class="pull-left"></span>
<span class="pull-right"><i class="fa fa-arrow-circle-right"></i></span>
<div class="clearfix"></div>
</div>
</a>
</div>
}
How to total and display values from child pages by month
Hi,
Just new to the forum and im looking for a bit of guidance. I have a reports container page and which shows a grid of data with values of links to child pages. What I am trying to do is calculate the totals by month and display a tile that shows the total for each month. I have attached a screenshot of the page and also my partial view macro. I can get the values to add up but not by month. Any help or guidance would be greatly appreciated.
@{ int MonthlyCatchTotal = 0; string sMonth = DateTime.Now.ToString("MMM");
}
Can anyone help with this issue?
is working on a reply...