Difference: SpreadSheetPlugin (28 vs. 29)

Revision 292014-09-23 - TWikiContributor

Line: 1 to 1
 
    Page contents    
Line: 68 to 68
 
  • Functions are evaluated from left to right, and from inside to outside if nested
  • A function parameter can be text, a mathematical formula, a cell address, or a range of cell addresses
  • Multiple parameters form a list; they are separated by a comma, followed by optional space, such as %CALCULATE{$SUM( 3, 5, 7 )}%
Changed:
<
<
  • A parameter representing a string can optionally be enclosed in triple quotes; quotes are required if the string contains commas or parenthesis, such as %CALCULATE{$SUBSTITUTE('''Good, early morning''', morning, day)}%
>
>
  • A parameter representing a string can optionally be enclosed in triple quotes; quotes are required if the string contains commas, parenthesis or newlines, such as %CALCULATE{$SUBSTITUTE('''Good, early morning''', morning, day)}%
  • The %CALCULATE{...}% variable may span multiple lines, which is useful to indent nested functions. In case the variable contains newlines, all white space around functions and function parameters is removed. Sample nested formula:
    %CALCULATE{
      $LISTJOIN(
        $n,
        $LISTEACH(
          | $index | $item |,
          one, two, three
        )
      )
    }%
 
  • A table cell can be addressed as R1:C1. Table address matrix:
    R1:C1 R1:C2 R1:C3 R1:C4
    R2:C1 R2:C2 R2:C3 R2:C4
Line: 105 to 115
 
Added:
>
>

ADDLIST( name, list ) -- append a list to a list variable

  • Specify the variable name (alphanumeric characters and underscores) and the list to add. If the named list does not exist it will be created. Useful in a FormattedSearch to add items to a list. This function returns no output. Use $GETLIST() to retrieve a list variable.
  • Syntax: $ADDLIST( name, list )
  • Example:
    %CALCULATE{$SETLIST(nums, 0, 1, 2, 3)}% sets the nums variable to 0, 1, 2, 3
    %CALCULATE{$ADDLIST(nums, 4, 5, 6, 7)}% adds 4, 5, 6, 7 to the nums variable
    %CALCULATE{$GETLIST(nums)}% returns 0, 1, 2, 3, 4, 5, 6, 7
  • Example formatted search:
    format="$percntCALCULATE{$ADDLIST(topics, $topic)}$percnt" in each search hit, adds the topic name to the topics list variable
  • Related: $GETLIST(), $SET(), $SETHASH(), $SETLIST()
 

AND( list ) -- logical AND of a list

  • Syntax: $AND( list )
Line: 292 to 314
 

FORMAT( type, precision, number ) -- format a number to a certain type and precision

  • Supported type:
    • COMMA for comma format, such as 12,345.68
Added:
>
>
    • CURRENCY for currency format, such as €12,345.68
      • Negative numbers are shown in parenthesis, such as (€6,789.00) for -6789
      • The currency symbol is taken from the CURRENCYSYMBOL preferences setting, such as US$ or $ for Dollar, &#8364; for Euro, &#165; for Yen, default $
 
    • DOLLAR for Dollar format, such as $12,345.68
Added:
>
>
      • Negative numbers are shown in parenthesis, such as ($6,789.00) for -6789
 
    • KB for Kilo Byte format, such as 1205.63 KB
    • MB for Mega Byte format, such as 1.18 MB
    • KBMB for Kilo/Mega/Giga/Tera Byte auto-adjust format
Line: 301 to 327
 
  • The precision indicates the the number of digits after the dot
  • Syntax: $FORMAT( type, prec, number )
  • Example: %CALCULATE{$FORMAT(COMMA, 2, 12345.6789)}% returns 12,345.68
Added:
>
>
  • Example: %CALCULATE{$FORMAT(CURRENCY, 2, 12345.6789)}% returns $12,345.68
 
  • Example: %CALCULATE{$FORMAT(DOLLAR, 2, 12345.6789)}% returns $12,345.68
  • Example: %CALCULATE{$FORMAT(KB, 2, 1234567)}% returns 1205.63 KB
  • Example: %CALCULATE{$FORMAT(MB, 2, 1234567)}% returns 1.18 MB
Line: 369 to 396
 
  • Specify the variable name (alphanumeric characters and underscores). An empty string is returned if the variable does not exist. Use $SET() to set a variable first. Unlike table ranges, variables live for the time of the page view and persist across tables, i.e. you can use it to summarize results across several tables.
  • Syntax: $GET( name )
  • Example: %CALCULATE{$GET(my_total)}% returns the value of the my_total variable
Changed:
<
<
>
>
 

GETHASH( name, key ) -- get the value of a previously set hash key

  • Specify the hash name and key; allowed characters for the hash name are alphanumeric characters, underscores and period. An empty string is returned if the hash key does not exist. Use $SETHASH() or $LIST2HASH() to set a hash. If the key is omitted, a list of all keys of the named hash is returned. If no parameters are specified, a list of all hash names is returned.
  • Syntax: $GETHASH( name, key )
  • Examples:
    %CALCULATE{$SETHASH(age, Jane, 26)}%
    %CALCULATE{$SETHASH(age, Tim, 27)}%
    %CALCULATE{$GETHASH(age, Jane)}% returns 26
    %CALCULATE{$GETHASH(age)}% returns Jane, Tim
    %CALCULATE{$GETHASH()}% returns age
Changed:
<
<
>
>

GETLIST( name ) -- get the list from a list variable

  • Specify the variable name (alphanumeric characters and underscores). An empty list is returned if the variable does not exist. Use $SETLIST() or $ADDLIST() to set a variable.
  • Syntax: $GETLIST( name )
  • Example: %CALCULATE{$GETLIST(nums)}% returns the value of the nums variable
  • Related: $ADDLIST(), $GET(), $GETHASH(), $SETLIST(), SetGetPlugin
 

HASH2LIST( name, format ) -- convert a hash to a list

Line: 787 to 821
 

SET( name, value ) -- set a variable for later use

Changed:
<
<
  • Specify the variable name (alphanumeric characters and underscores) and the value. The value may contain a formula; formulae are evaluated before the variable assignment; see $NOEXEC() if you want to prevent that. This function returns no output. Use $GET() to retrieve variables. Unlike table ranges, variables live for the time of the page view and persist across tables, i.e. you can use it to summarize results across several tables and also across included topics
>
>
  • Specify the variable name (alphanumeric characters and underscores) and the value. The value may contain a formula; formulae are evaluated before the variable assignment; see $NOEXEC() if you want to prevent that. This function returns no output. Use $GET() to retrieve variables. Unlike table ranges, variables live for the time of the page view and persist across tables, i.e. you can use it to summarize results across several tables and also across included topics. If the value is omitted, the named variable is deleted.
 
  • Syntax: $SET( name, value )
  • Example: %CALC{$SET(my_total, $SUM($ABOVE()))}% sets the my_total variable to the sum of all table cells located above the current cell and returns an empty string
Changed:
<
<
>
>
 

SETHASH( name, key, value ) -- set a hash value for later use, or delete a hash

Line: 801 to 835
 
  • Example: %CALCULATE{$SETHASH(age, Jane)}% deletes key Jane of hash named age
  • Example: %CALCULATE{$SETHASH(age)}% deletes hash named age
  • Example: %CALCULATE{$SETHASH()}% deletes all hashes
Changed:
<
<
>
>
 

SETIFEMPTY( name, value ) -- set a variable only if empty

Line: 810 to 844
 
  • Example: %CALCULATE{$SETIFEMPTY(result, default)}% sets the result variable to default if the variable is empty or 0; in any case an empty string is returned
  • Related: $GET(), $SET(), $SETHASH(), $SETMHASH()
Added:
>
>

SETLIST( name, list ) -- save a list for later use

  • Specify the variable name (alphanumeric characters and underscores) and the list. This function returns no output. Use $GETLIST() to retrieve a list variable. Use $ADDLIST() to add a list to an existing variable. If no list is specified, the named variable is deleted.
  • Syntax: $SETLIST( name, list )
  • Example: %CALCULATE{$SETLIST(octals, 0, 1, 2, 3, 4, 5, 6, 7)}% sets the octals variable to 0, 1, 2, 3, 4, 5, 6, 7
  • Example: %CALCULATE{$SETLIST(octals)}% deletes the octals variable
  • Related: $ADDLIST(), $GETLIST(), $SET(), $SETHASH(), SetGetPlugin
 

SETM( name, formula ) -- modify an existing variable based on a formula

  • Specify the variable name (alphanumeric characters and underscores) and the formula. The formula must start with an operator to + (add), - (subtract), * (multiply), or / (divide) something to the variable. This function returns no output. Use $GET() to retrieve variables
Line: 1030 to 1072
  "form.name='FeatureForm'" type="query" nonoise="on"
Changed:
<
<
format="$percntCALCULATE{$SETHASH(status, $topic, $formfield(Status))$SETHASH(summary, $topic, $summary(entityencode))$SETHASH(date, $topic, $date)}$percnt"
>
>
format="$percntCALCULATE{$SETHASH(status, $topic, $formfield(Status))$SETHASH(summary, $topic, '''$summary''')$SETHASH(date, $topic, '''$date''')}$percnt"
 }%

Proposed Features

Feature Updated
Changed:
<
<
>
>
 

Accepted Features

Feature Updated
Changed:
<
<
>
>
 

First we search all features and store the status, summary and date in hashes, using the topic name as the key. Then we build a table that shows all proposed features, followed by a table showing all accepted features. Reading the CALCULATE formula from inside out:

Line: 1115 to 1185
 
  • Do not handle %CALC{}% variable in included topic while including topic: (default: 1) (See note CALC in Included Topics)
    • Set SKIPINCLUDE = 1
Added:
>
>
  • Currency symbol. Specify US$ or $ for Dollar, &#8364; for Euro, &#165; for Yen:
    • Set CURRENCYSYMBOL = $
 
  • WikiWords to exclude from being spaced out by the $PROPERSPACE(text) function. This comma delimited list can be overloaded by a DONTSPACE preferences variable:
    • Set DONTSPACE = CodeWarrior, MacDonald, McIntosh, RedHat, SuSE
Line: 1154 to 1227
 
Plugin Author: TWiki:Main.PeterThoeny
Changed:
<
<
Copyright: © 2001-2013 Peter Thoeny, TWiki.org
© 2008-2013 TWiki:TWiki.TWikiContributor
© 2013 Wave Systems Corp.
>
>
Copyright: © 2001-2014 Peter Thoeny, TWiki.org
© 2008-2014 TWiki:TWiki.TWikiContributor
© 2014 Wave Systems Corp.
 
Sponsor: Wave Systems Corp. for hash functions
License: GPL (GNU General Public License)
Changed:
<
<
Plugin Version: 2013-10-10
>
>
Plugin Version: 2014-09-23
 
<--/twistyPlugin twikiMakeVisibleInline-->
Added:
>
>
2014-09-23: TWikibug:Item7553: Allow newlines and indent around functions and function parameters
2014-09-22: TWikibug:Item7552: Allow newlines in triple-quoted strings
2014-03-04: TWikibug:Item7445: Add FORMAT(CURRENY, ...) with support for currency symbol
2014-01-22: TWikibug:Item7419: Add ADDLIST(), GETLIST(), SETLIST()
2014-01-22: TWikibug:Item7418: Fix VALUE function bug with incorrect exponential number; ability to delete SET variable; do not strip trailing spaces in SETIFEMPTY
 
2013-10-10: TWikibug:Item7154: Doc update: Put TOC on top right for easy reference
2013-09-14: TWikibug:Item7299: Fix plural of month to months in FORMATTIMEDIFF
Changed:
<
<
2013-08-21: TWikibug:Item7322: TRANSLATE supporting double quote and apostrophe-quote (single quote) excape tokens
>
>
2013-08-21: TWikibug:Item7322: TRANSLATE supporting double quote and apostrophe-quote (single quote) escape tokens
 
2013-07-18: TWikibug:Item7299: Add short and compact format to FORMATTIMEDIFF
2013-06-20: TWikibug:Item7154: Fix encoding of URL parameter in the interactive example so that $IF(1>2, true, false) works properly
2013-05-21: TWikibug:Item7154: Small doc fixes
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 1999-2017 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding URCS? Send feedback
Note: Please contribute updates to this topic on TWiki.org at TWiki:TWiki.SpreadSheetPlugin.