| TWiki Spreadsheet Plugin
This Plugin adds spreadsheet capabilities to TWiki topics. Formulae like %CALC{"$INT(7/3)"}% are evaluated at page view time. They can be placed in table cells and outside of tables. In other words, this Plugin provides general formula evaluation capability, not just classic spreadsheet functions. |
|
|
|
< < | AND( list ) -- logcial AND of a list |
> > | AND( list ) -- logical AND of a list |
|
- Syntax:
$AND( list )
- Example:
%CALC{"$AND(1, 0, 1)"}% returns 0
- Related:
$NOT() , $IF() , $OR()
|
|
- 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:
%CALC{"$GET(my_total)"}% returns the value of the my_total variable
|
|
< < | |
> > | |
|
IF( condition, value if true, value if 0 ) -- return a value based on a condition |
|
|
|
< < | OR( list ) -- logcial OR of a list |
> > | OR( list ) -- logical OR of a list |
|
- Syntax:
$OR( list )
- Example:
%CALC{"$OR(1, 0, 1)"}% returns 1
- Related:
$AND() , $IF() , $NOT()
|
| PROPERSPACE( text ) -- properly space out WikiWords
- Properly spaces out WikiWords preceeded by white space, parenthesis, or
][ . Words listed in the DONTSPACE TWikiPreferences variable or DONTSPACE Plugins setting are excluded
- Syntax:
$PROPERSPACE( text )
|
|
< < |
- Example: Assuming DONTSPACE contains MacDonald:
%CALC{"$PROPERSPACE(Old MacDonald had a ServerFarm, EeEyeEeEyeOh"}% returns Old MacDonald had a Server Farm, Ee Eye Ee Eye Oh
|
> > |
- Example: Assuming DONTSPACE contains MacDonald:
%CALC{"$PROPERSPACE(Old MacDonald had a ServerFarm, EeEyeEeEyeOh)"}% returns Old MacDonald had a Server Farm, Ee Eye Ee Eye Oh
|
|
|
|
SET( name, value ) -- set a variable for later use |
|
< < |
- 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 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
|
|
- 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
|
|
< < | |
> > |
SETIFEMPTY( name, value ) -- set a variable only if empty
- Specify the variable name (alphanumeric characters and underscores) and the value.
- Syntax:
$SETIFEMPTY( name, value )
- Example:
%CALC{"$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()
|
|
SETM( name, formula ) -- update 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
- Syntax:
$SETM( name, formula )
- Example:
%CALC{"$SETM(total, + $SUM($LEFT()))"}% adds the sum of all table cells on the left to the total variable, and returns an empty string
|
|
< < | |
> > | |
|
SIGN( num ) -- sign of a number |
|
data/TWiki/SpreadSheetPlugin.txt | Plugin topic |
data/TWiki/SpreadSheetPlugin.txt,v | Plugin topic repository |
lib/TWiki/Plugins/SpreadSheetPlugin.pm | Plugin Perl module |
|
|
< < |
- (Dakar) Visit
configure in your TWiki installation, and enable the plugin in the {Plugins} section.
|
> > |
- TWiki 4 and up: Visit
configure in your TWiki installation, and enable the Plugin in the {Plugins} section.
|
|
- Test if the "Total" in the first table in this topic is correct.
Plugin Info
|
|
< < |
Plugin Version: | 17 Jun 2005 (1.018) |
|
> > |
|
|
Change History: | <-- specify latest version first --> |
|
|
> > |
13 May 2006: | Added $SETIFEMPTY(); fixes in documentation |
|
|
17 Jun 2005: | Added $NOEXEC(), $EXEC() |
25 Mar 2005: | Fixed evaluation bug when using SpeedyCGI accelerator; code refactor to load module only when needed, contributed by TWiki:Main/CrawfordCurrie |
24 Oct 2004: | Added $EXISTS(), contributed by TWiki:Main/RodrigoChandia; added $PERCENTILE() |
|
|
|
|
> > |
|
| Related Topics: TWikiPreferences, TWikiPlugins |
|
< < | -- TWiki:Main/PeterThoeny - 17 Jun 2005 |
> > | -- TWiki:Main/PeterThoeny - 13 May 2006 |
| |