Documentation
See also: Log > Egg Log,
Egg Log Data Form
Parameters
Implementation
%STARTINCLUDE%
%INCLUDE{"%SYSTEMWEB%.JSCalendarContribInline"}%
%INCLUDE{"%WEB%.%TOPIC%"
section="filter"
}%
%NEWMETADATA{"egglog"
topic="%BASEWEB%.%BASETOPIC%"
buttontitle="Post New Weekly Record"
title="Enter Weekly Data by Household"
Hens_value="%RENDERMETADATA{"egglog" topic="EggLog" web="Log" sort="StartDate" reverse="on" limit="1" format="$Hens" header="" footer=""}%"
Hens_default="%RENDERMETADATA{"egglog" topic="EggLog" web="Log" sort="StartDate" reverse="on" limit="1" format="$Hens" header="" footer=""}%"
Sun_value="5"
StartDate_value="%DATETIME{"%RENDERMETADATA{"egglog" topic="EggLog" web="Log" sort="StartDate" reverse="on" limit="1" format="$StartDate" header="" footer=""}%" delta="0:0:1:0:0:0:0" format="$day $mon $year"}%"
}%
%INCLUDE{"%WEB%.%TOPIC%"
section="table"
EGGDATA="%INCLUDE{"%WEB%.%TOPIC%" section="data"}%"
}%
%STOPINCLUDE%
%IF{"'%WIKINAME%'='LynnwoodBrown'"
then="$percntINCLUDE{\"%WEB%.%TOPIC%\"
section=\"table2\"
warn=\"off\"
EGGDATA=\"$percntINCLUDE{\"%WEB%.%TOPIC%\" section=\"data2\"}$percnt\"
}$percnt"
}%
Filter
%STARTSECTION{"filter"}%
<form action='%SCRIPTURL{view}%/%BASEWEB%/%BASETOPIC%'>
*Display data for period:* <input type="text" name="start_date" class="foswikiInputField" id="start_date" value="%URLPARAM{"start_date" default="Jan 01 2023"}%"/>
<img src="%PUBURLPATH%/%SYSTEMWEB%/JSCalendarContrib/img.gif" class="foswikiButton foswikiEditFormCalendarButton" onclick="return showCalendar('start_date','%e %b %Y')" />
*Thru* <input type="text" class="foswikiInputField" name="end_date" id="end_date" value="%URLPARAM{"end_date" default="%SERVERTIME{"$day $mon $year"}%"}%"/>
<img src="%PUBURLPATH%/%SYSTEMWEB%/JSCalendarContrib/img.gif" class="foswikiButton foswikiEditFormCalendarButton" onclick="return showCalendar('start_date','%e %b %Y')" />
%BUTTON{"Update" type="submit"}%</form>
%ENDSECTION{"filter"}%
Values references:
- id (of metadata)
- StartDate~
- GatheredBy~
- Sun~
- Mon~
- Tues~
- Wed~
- Thurs~
- Fri~
- Sat~
- Total
- Hens (count)
Format:
id~StartDate~GatheredBy~Sun~Mon~Tues~Wed~Thurs~Fri~Sat~Total~Hens
%STARTSECTION{"data"}%%RENDERMETADATA{"egglog"
topic="%BASEWEB%.%BASETOPIC%"
sort="StartDate"
reverse="on"
format="$id~$StartDate~$GatheredBy~$percntIF{\"'$Sun'=''\" then=\"0\" else=\"$Sun\"}$percnt~"
+"$percntIF{\"'$Mon'=''\" then=\"0\" else=\"$Mon\"}$percnt~"
+"$percntIF{\"'$Tues'=''\" then=\"0\" else=\"$Tues\"}$percnt~"
+"$percntIF{\"'$Wed'=''\" then=\"0\" else=\"$Wed\"}$percnt~"
+"$percntIF{\"'$Thur'=''\" then=\"0\" else=\"$Thur\"}$percnt~"
+"$percntIF{\"'$Fri'=''\" then=\"0\" else=\"$Fri\"}$percnt~"
+"$percntIF{\"'$Sat'=''\" then=\"0\" else=\"$Sat\"}$percnt~"
+"$percntCALCULATE{\"$SUM($Sun,$Mon,$Tues,$Wed,$Thur,$Fri,$Sat)\"}$percnt~"
+"$Hens"
separator="##"
header=""
footer=""
%IF{"defined start_date" then=" filter=\"d2n(StartDate) >= d2n('%URLPARAM{start_date}%') AND d2n(StartDate) <= d2n('%URLPARAM{end_date}%')\""}%
}%%ENDSECTION{"data"}%
Values references:
1 epoch
2 <nop>GatheredBy~
3 <nop>StartDate~
4 id (of metadata)
5 Sun~
6 Mon~
7 Tues~
8 Wed~
9 Thurs~
10 Fri~
11 Sat~
12 Total
13 Hens
%STARTSECTION{"data2"}%%RENDERMETADATA{"egglog"
topic="%BASEWEB%.%BASETOPIC%"
sort="StartDate"
reverse="on"
format="$percntCALCULATE{\"$EVAL($TIME($StartDate) + $GatheredBy)\"}$percnt~$GatheredBy~$StartDate~$id~$percntIF{\"'$Sun'=''\" then=\"0\" else=\"$Sun\"}$percnt~"
+"$percntIF{\"'$Mon'=''\" then=\"0\" else=\"$Mon\"}$percnt~"
+"$percntIF{\"'$Tues'=''\" then=\"0\" else=\"$Tues\"}$percnt~"
+"$percntIF{\"'$Wed'=''\" then=\"0\" else=\"$Wed\"}$percnt~"
+"$percntIF{\"'$Thur'=''\" then=\"0\" else=\"$Thur\"}$percnt~"
+"$percntIF{\"'$Fri'=''\" then=\"0\" else=\"$Fri\"}$percnt~"
+"$percntIF{\"'$Sat'=''\" then=\"0\" else=\"$Sat\"}$percnt~"
+"$percntCALCULATE{\"$SUM($Sun,$Mon,$Tues,$Wed,$Thur,$Fri,$Sat)\"}$percnt"
+"$Hens"
separator="##"
header=""
footer=""
%IF{"defined start_date" then=" filter=\"d2n(StartDate) >= d2n('%URLPARAM{start_date}%') AND d2n(StartDate) <= d2n('%URLPARAM{end_date}%')\""}%
}%
%ENDSECTION{"data2"}%
%STARTSECTION{"table"}%
%TWISTY{showlink="%BUTTON{"Show Records" icon="fa-table"}%%CLEAR%"
hidelink="%BUTTON{"Hide Records" icon="fa-table"}%%CLEAR%"
}%<div class='metaDataView' style='overflow: scroll'>
%FORMATLIST{"%EGGDATA%"
split="##"
pattern="([^~]*)~([^~]*)~([^~]*)~([^~]*)~([^~]*)~([^~]*)~([^~]*)~([^~]*)~([^~]*)~([^~]*)~([^~]*)~(.*)"
header="<table class='foswikiTable ' style='width:100%'><thead>"
+"<tr><th> Start Date </th><th> Gathered By </th><th> Hens </th><th> Sun </th><th> Mon </th>"
+"<th> Tues </th><th> Wed </th><th> Thur </th><th> Fri </th><th> Sat </th><th> Total </th></tr></thead><tbody>"
format="<tr class='metaDataRow'><td> $2 </td><td> $3 $percntCALCULATE{\"$SETM($3_total, + $11)$SETM(combined_total, + $11)$SET($3_weeks, $GET($3_weeks)$2, )\"}$percnt</td>"
+"<td>$12</td><td>$4</td><td>$5</td><td>$6</td><td>$7</td><td>$8</td><td>$9</td><td>$10</td>"
+"<td>$11 $percntCALCULATE{\"$IF($index == 1, $SET(hen_avg, $EVAL($11/$12)))\"}$percnt$percntINCLUDE{\"%WEB%.%TOPIC%\" section=\"actions\" RECORD=\"$1\"}$percnt</td></tr>"
separator="$n"
footer="</tbody></table>$n"
}%
</div>
%ENDTWISTY%
*Summary Stats for Period:*
| *<nop>* | *701* | *649* | *Combined* |
| *Total eggs gathered:* | %CALCULATE{"$GET(701_total) | $GET(649_total) | $GET(combined_total)"}% |
| *Weeks gathered:* | %CALCULATE{"$SET(701_wk_count, $LISTSIZE($GET(701_weeks)))$GET(701_wk_count) | $SET(649_wk_count, $LISTSIZE($GET(649_weeks)))$GET(649_wk_count) | $SET(combined_wk_count, $LISTSIZE($LISTUNIQUE($GET(701_weeks),$GET(649_weeks))))$GET(combined_wk_count)"}% |
| *Week Avg:* | %CALCULATE{"$ROUND($EVAL($GET(701_total) / $GET(701_wk_count)), 1) | $ROUND($EVAL($GET(649_total) / $GET(649_wk_count)), 1) | $ROUND($EVAL($GET(combined_total) / $GET(combined_wk_count)), 1)"}% |
| *Eggs per Hen (past wk)* ||| %CALCULATE{"$GET(hen_avg)"}% |
%INCLUDE{"%WEB%.%TOPIC%" section="chart" warn="off"}%
%INCLUDE{"%WEB%.%TOPIC%" section="chartdata" warn="off"}%
%ENDSECTION{"table"}%
%STARTSECTION{"table2"}%
%FORMATLIST{"%EGGDATA%"
split="##"
pattern="([^~]*)~([^~]*)~([^~]*)~([^~]*)~([^~]*)~([^~]*)~([^~]*)~([^~]*)~([^~]*)~([^~]*)~([^~]*)~(.*)"
header="$percntCALCULATE{\"$SET(701_total,)$SET(649_total,)$SET(701_weeks,)$SET(649_weeks,)$SET(701_wk_count,)$SET(649_wk_count,)$SET(combined_total,)$SET(combined_wk_count,)\"}$percnt"
+"$percntTWISTY{showlink=\"$percntBUTTON{\"Show Records\" icon=\"fa-table\"}$percnt$percntCLEAR$percnt\" "
+"hidelink=\"$percntBUTTON{\"Hide Records\" icon=\"fa-table\"}$percnt$percntCLEAR$percnt\"}$percnt$n"
+"<div class='metaDataView'><table class='foswikiTable ' style='width:100%'><thead>"
+"<tr><th> Start Date </th><th> Gathered By </th><th> Sun </th><th> Mon </th>"
+"<th> Tues </th><th> Wed </th><th> Thur </th><th> Fri </th><th> Sat </th><th> Total </th></tr></thead><tbody>"
format="<tr class='metaDataRow'><td> $3 </td><td> $2 $percntCALCULATE{\"$SETM($2_total, + $12)$SETM(combined_total, + $12)$SET($2_weeks, $GET($2_weeks)$3, )\"}$percnt</td>"
+"<td>$5</td><td>$6</td><td>$7</td><td>$8</td><td>$9</td><td>$10</td><td>$11</td>"
+"<td>$12 $percntINCLUDE{\"%WEB%.%TOPIC%\" section=\"actions\" RECORD=\"$4\"}$percnt</td>"
separator="$n"
footer="</tbody></table></div>$percntENDTWISTY$percnt$n$n*Summary Stats for Period:*$n"
+"| *<nop>* | *701* | *649* | *Combined* |$n"
+"| *Total eggs gathered:* | $percntCALCULATE{\"$GET(701_total) | $GET(649_total) | $GET(combined_total)\"}$percnt |$n"
+"| *Week count:* | $percntCALCULATE{\"$SET(701_wk_count, $LISTSIZE($GET(701_weeks)))$GET(701_wk_count) | $SET(649_wk_count, $LISTSIZE($GET(649_weeks)))$GET(649_wk_count) | $SET(combined_wk_count, $LISTSIZE($LISTUNIQUE($GET(701_weeks),$GET(649_weeks))))$GET(combined_wk_count)\"}$percnt |$n"
+"| *Week Avg:* | $percntCALCULATE{\"$ROUND($EVAL($GET(701_total) / $GET(701_wk_count)), 1) | $ROUND($EVAL($GET(649_total) / $GET(649_wk_count)), 1) | "
+"$ROUND($EVAL($GET(combined_total) / $GET(combined_wk_count)), 1)\"}$percnt |"
}%
<pre>%EGGDATA%</pre>
%ENDSECTION{"table2"}%
Record Actions
Parameters:
%STARTSECTION{"actions"}%%RENDERMETADATA{"egglog" name="%RECORD%" header="" footer="" format="$actions"}%%ENDSECTION{"actions"}%
Chart
%STARTSECTION{"chart"}%%ADDTOZONE{"script" id="HIGHCHARTS" requires="JQUERYPLUGIN"
text="<script src='https://code.highcharts.com/highcharts.js'></script>
<script src='https://code.highcharts.com/modules/data.js'></script>
<script src='https://code.highcharts.com/modules/exporting.js'></scr
<script src='https://code.highcharts.com/modules/accessibility.js'></script>
$percntINCLUDE{\"%WEB%.%TOPIC%\" section=\"config\"}$percnt"
}%<div id="container"></div>
%ENDSECTION{"chart"}%
Chart Config
%STARTSECTION{"config"}%
<literal><script type='text/javascript'>
$(document).ready(function(){
// THE CHART
Highcharts.chart('container', {
chart: {
type: 'line',
events: {
load: function () {
var theSeries = this.series;
$.each(theSeries, function () {
if (this.index < 2) {
this.setVisible(false);
}
});
}
}
},
title: {
text: 'Egg Production',
align: 'center'
},
xAxis: {
type: 'datetime',
title: {
text: 'Date'
}
},
yAxis: {
title: {
text: 'Number of Eggs'
}
},
data: {
csv: document.getElementById('csv').innerHTML
}
});
});
</script></literal>"
%ENDSECTION{"config"}%
Chart Data
%STARTSECTION{"chartdata"}%
%SET{"dates" value="%FORMATLIST{"%EGGDATA%"
split="##"
pattern=".*?~(.*?)~.*"
format="$percntCALCULATE{\"$TIME($1 LOCAL)\"}$percnt~$1"
unique="on"
sort="off"
separator="##"
}%"}%%FORMATLIST{"%dates%"
split="##"
pattern="([^~]*)~(.*)"
separator="$n"
reverse="on"
header="<literal><pre id='csv' style='display:%IF{"defined debug" then="block" else="none"}%'>$nDay,701,649,Combined,Weekyly Average$n"
footer="$n</pre></literal>"
format="$percntFORMATLIST{\"%EGGDATA%\"
split=\"##\"
include=\"[^~]*~$2~.*\"
pattern=\"[^~]*~[^~]*~([^~]*)~([^~]*)~([^~]*)~([^~]*)~([^~]*)~([^~]*)~([^~]*)~([^~]*)~([^~]*)~(.*)\"
header=\"$dollarpercntCALCULATE{\\"$SET(sun_701,0)$SET(mon_701,0)$SET(tue_701,0)$SET(wed_701,0)$SET(thu_701,0)$SET(fri_701,0)$SET(sat_701,0)$SET(sun_649,0)$SET(mon_649,0)$SET(tue_649,0)$SET(wed_649,0)$SET(thu_649,0)$SET(fri_649,0)$SET(sat_649,0)$SET(wk_sum,0)\\"}$dollarpercnt\"
format=\"$dollarpercntCALCULATE{\\"$SET(sun_$dollar1, $dollar2)$SET(mon_$dollar1`, $dollar3)$SET(tue_$dollar1, $dollar4)$SET(wed_$dollar1, $dollar5)$SET(thu_$dollar1, $dollar6)$SET(fri_$dollar1, $dollar7)$SET(sat_$dollar1, $dollar8)$SETM(wk_sum, + $dollar9)\\"}$dollarpercnt\"
separator=\"\"
footer=\"$dollarpercntCALCULATE{\\"$SET(wk_avg, $ROUND($EVAL($GET(wk_sum) / 7), 1))$FORMATTIME($1,$year-$mo-$day),$GET(sun_701),$GET(sun_649),$EVAL($GET(sun_701) + $GET(sun_649)),$GET(wk_avg)'''$dollarn'''$FORMATTIME($TIMEADD($1, 1, day),$year-$mo-$day),$GET(mon_701),$GET(mon_649),$EVAL($GET(mon_701) + $GET(mon_649)),$GET(wk_avg)'''$dollarn'''$FORMATTIME($TIMEADD($1, 2, day),$year-$mo-$day),$GET(tue_701),$GET(tue_649),$EVAL($GET(tue_701) + $GET(tue_649)),$GET(wk_avg)'''$dollarn'''$FORMATTIME($TIMEADD($1, 3, day),$year-$mo-$day),$GET(wed_701),$GET(wed_649),$EVAL($GET(wed_701) + $GET(wed_649)),$GET(wk_avg)'''$dollarn'''$FORMATTIME($TIMEADD($1, 4, day),$year-$mo-$day),$GET(thu_701),$GET(thu_649),$EVAL($GET(thu_701) + $GET(thu_649)),$GET(wk_avg)'''$dollarn'''$FORMATTIME($TIMEADD($1, 5, day),$year-$mo-$day),$GET(fri_701),$GET(fri_649),$EVAL($GET(fri_701) + $GET(fri_649)),$GET(wk_avg)'''$dollarn'''$FORMATTIME($TIMEADD($1, 6, day),$year-$mo-$day),$GET(sat_701),$GET(sat_649),$EVAL($GET(sat_701) + $GET(sat_649)),$GET(wk_avg)\\"}$dollarpercnt\"
}$percnt"
}%
</noautolink>
%ENDSECTION{"chartdata"}%
Calls to 'RenderEggLog'
Copyright
© 2015 Your Name
This file is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version. For
more details read the
LICENSE.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.