--- loncom/html/adm/help/tex/Spreadsheet_Functions.tex 2003/10/14 16:03:51 1.7 +++ loncom/html/adm/help/tex/Spreadsheet_Functions.tex 2016/12/29 02:12:15 1.11 @@ -32,34 +32,47 @@ for information on specifying cells and range \index{MIN} -\item \texttt{\&SUMMAX(n ,range)} - sum of the maximum n non-empty +\item \texttt{\&SUMMAX(n ,range)} - sum of the maximum $n$ non-empty cells in range \index{SUMMAX} -\item \texttt{\&SUMMIN(n, range)} - sum of the minimum n non-empty +\item \texttt{\&SUMMIN(n, range)} - sum of the minimum $n$ non-empty cells in range \index{SUMMIN} \item \texttt{\&EXT(expression)} - access to EXT function in lonnet. -Use \&EXT(``system.time'') to retrieve the current time. +Use \texttt{\&EXT(`system.time')} to retrieve the current time. \index{EXT} +\item \texttt{\&PARM(parameter)} - get the value of a specific parameter +\index{PARM} + +\item \texttt{\&MINPARM(expression)} - get the value of a parameter that +matches the expression that is the smallest in value (If one specified +'opendate' it would return the smallest opendate set on the problem.) +\index{MINPARM} + +\item \texttt{\&MAXPARM(expression)} - get the value of a parameter that +matches the expression that is the largest in value (If one specified +'opendate' it would return the largest opendate set on the problem.) +\index{MAXPARM} + \item \texttt{\&SUMSEQ(column,sequence1,sequence2,sequence3,...)} - -sum the given column across the folders or sequences listed. +sum the given column across the folders or sequences listed. When specifying a sequence use the full title. Instead of a sequence title -the word ``all'' can be used to sum over all sequences. Regular expressions -can be entered as well, if prefixed by ``regexp:''. See below for examples. +the word \texttt{all} can be used to sum over all sequences. Regular expressions +can be entered as well, if prefixed by \texttt{regexp:}. See below for examples. \begin{itemize} -\item \texttt{\&SUMSEQ(``Z'',''Chapter 1'');} +\item \texttt{\&SUMSEQ(`Z',`Chapter 1');} -\item \texttt{\&SUMSEQ(``Z'',''Chapter 1'',''Chapter 2'',''Chapter 3'');} +\item \texttt{\&SUMSEQ(`Z',`Chapter 1',`Chapter 2',`Chapter 3');} -\item \texttt{\&SUMSEQ(``Z'',''all'');} - sum over all sequences. +\item \texttt{\&SUMSEQ(`Z',`all');} - sum over all sequences. -\item \texttt{\&SUMSEQ(``Z'',''regexp:Large Biomolecules'');} - +\item \texttt{\&SUMSEQ(`Z',`regexp:Large Biomolecules');} - sum over all sequences which match the regular expression /Large Biomolecules/. @@ -67,4 +80,23 @@ can be entered as well, if prefixed by ` \end{itemize} -In addition, most non-IO Perl functions work in cells. +\noindent +In addition, most non-IO Perl functions work in cells. Perl offers a compact \texttt{if} structure using the logic +\texttt{TEST\char`_EXPR?IF\char`_TRUE\char`_EXPR\char`:IF\char`_FALSE\char`_EXPR;}. The \texttt{if} statements can be nested. Suppose that students are to receive full credit for a correct answer on the first attempt, 3/4 credit for a correct answer on two attempts, and half credit for a correct answer on more than two attempts. To scale the points awarded on the assessment spreadsheet (by default in \texttt{Z0}) with the number of tries (by default in \texttt{C0}), the adjusted score can be programmed in an empty export cell in the Assessment Spreadsheet row 0, as illustrated by the following example:\\ + +\noindent +\texttt{C0$>$2 ? (0.5*Z0) \char`: (C0$>$1 ? (0.75*Z0) \char`: Z0);}\\ + +\noindent +is equivalent to + +\begin{verbatim} +if (C0 > 2) { + $cellvalue = 0.5*Z0; +} elsif (C0 > 1) { + $cellvalue = 0.75*Z0; +} else {$cellvalue = Z0;} +$cellvalue; +\end{verbatim} + +Use of parantheses is usually necessary in the compact \texttt{if} statement to assure correct precedence.