Tags:
create new tag
, view all tags

TWiki Variables » Search » Category: Development

CALC{"formula"} -- add spreadsheet calculations to tables

  • The %CALC{formula}% variable is handled by the SpreadSheetPlugin. Over 100 functions are available, such as $ABS(), $EXACT(), $EXISTS(), $GET()/$SET(), $IF(), $LOG(), $LOWER(), $PERCENTILE(), $TIME(), $VALUE().
  • Syntax: %CALC{formula}%
  • Examples:
    • %CALC{$SUM($ABOVE())}% returns the sum of all cells above the current cell
    • %CALC{$EXISTS(Web.SomeTopic)}% returns 1 if the topic exists
    • %CALC{$UPPER(Collaboration)}% returns COLLABORATION
  • Note: The CALC variable is handled with delay compared to other TWiki variables. You may get unexpected results if you nest CALC inside other variables (such as %INCLUDE{%CALC{...}%}%) because it does not get evaluated inside-out & left-to-right like ordinary TWiki variables. Use CALCULATE if you nest variables.
  • Category: DevelopmentVariables, TablesAndSpreadsheetsVariables
  • Related: CALCULATE, IF, IfStatements, SpreadSheetPlugin (this topic)

CALCULATE{"formula"} -- handle spreadsheet calculations outside tables

  • The %CALCULATE{formula}% variable is handled by the SpreadSheetPlugin. Over 100 functions are available, such as $ABS(), $EXACT(), $EXISTS(), $GET()/$SET(), $IF(), $LOG(), $LOWER(), $PERCENTILE(), $TIME(), $VALUE().
  • Syntax: %CALC{formula}%
  • Examples:
    • %CALC{$EXISTS(Web.SomeTopic)}% returns 1 if the topic exists
    • %CALC{$UPPER(Collaboration)}% returns COLLABORATION
  • Note: The CALCULATE variable is handled inside-out & left-to-right like ordinary TWiki variables, but it does not support functions that refer to table cells, such as $LEFT() or $T(). Use CALC instead.
  • Category: DevelopmentVariables, TablesAndSpreadsheetsVariables
  • Related: CALC, IF, IfStatements, SpreadSheetPlugin (this topic)

DASHBOARD -- build a dashboard with banner and boxes

DATATBL{"topic" format="..."} -- look up a table

  • Look up a table in the TWiki table markup on the specified topic. And then compose an ouput in the similar manner as SEARCH{...}.
  • Syntax: %DATATBL{ "topic" format="..." separator="..." }%
  • Parameters:
    Parameter Description Default
    "topics" comma separated topics whose first table is looked up. If multiple topics are specified, tables on the topics are combined and hanled as if there is one big table  
    "escaped_variable" Instead of comma separated topics, you can specify an escaped TWiki variable such as $percntINCLUDE{\"http://foo/bar\"}$percnt. Then the variable is expanded and the result becomes the data soruce. Read Getting table data dynamically for more information  
    assumedcols="COLUMNS" causes COLUMNS to be assumed. Read Referring to non-existent columns for more information  
    evalcell="on" causes variable expansion in table data. Read Expand variables in cells for more information off
    COLUMN_NAME="VALUES" select rows whose COLUMN_NAME column has either of comma separated VALUES. Read Select rows for more information  
    by="COLUMN_NAME" value="VALUES" Same as above. But if COLUMN_NAME starts with a lower case letter, this format needs to be used  
    ignorenull="on" causes null result to resort to ifnomatch value. Read Treat null value as no match for more information off
    ignorecase="on" causes string comparison to case insensitive off
    sort="COLUMN"
    sorta="COLUMN"
    sortn="COLUMN"
    sorts the output chunks based on a source table column. sort is for case-sensitive string sort, sorta is for case-insensitive (alphabetical) string sort, and sortn is for numeric sort. The sorting result is in the ascending order. To get the decending order, specify reverse="on" in addition no sorting
    reverse="on" specifies the order of output chunks to be reversed. If combined with sort="COLUMN", output chunks are sorted in the descending order  
    limit="NUMBER" specifies the maximum number of rows selected no limit
    transposed="on" species that the topics have transposed tables - the first column has field names and the second column has field values. Read Transposed tables for more information off
    split="SPLIT_PATTERN" may be used when transposed="on" (above) is specified. It specifies a pattern to split tables even within a table  
    trfrom="SEARCH_LIST"
    trto="REPLACE_LIST"
    tropt="OPTIONS"
    causes transliteration in the result. Read Transliteration for more information  
    format="..." specifies the format of each output chunk corresponding a selected source table row. Read Format parameter for more information $Name
    separator="..." specifies a separator between output chunks. This is the same as the separator parameter of SEARCH{...} (null string)
    separatorN="..." specifies a separator inserted every N output chunks. Read Different separators at different places for more information  
    ifnomatch="STRING" causes the STRING to be yielded when there is no matching row. Read When there is no match for more information  
  • Category: DevelopmentVariables, DatabaseAndFormsVariables, SearchingAndListingVariables
  • Related: DataTablePlugin, SEARCH, FormattedSearch (this topic)

DOXYGENIMPORT{"..."} -- import Doxygen documentation into TWiki

_INCLUDE

EJS_INCLUDE -- execute and include topic containing EJS tags

EXAMPLEVAR -- example variable

  • The %EXAMPLEVAR{}% variable is handled by the EmptyPlugin
  • Syntax: %EXAMPLEVAR{"text" format="..."}%
  • Parameter text="..." - example text.
  • Parameter format="..." - format of report.
  • Example: %EXAMPLEVAR{"hello" format="| $topic: $summary |"}%
  • Category: DevelopmentVariables
  • Related: EmptyPlugin (this topic)

EXECUTE{ "script" } -- safely execute shell scripts or Perl code - use TWiki as the user interface for external applications

GEOLOOKUP -- lookup geo location by IP address or domain name

GET{"name"} -- get a variable

  • Get the value of a named variable, previously set with %SET{}%. The %SET{}% and %GET{}% variables are handled by the SetGetPlugin.
  • Syntax: %GET{ "name" default="..." }%
  • Parameters:
    Parameter Description Default
    "name" Name of variable, such as menu. May optionally contain a JSON path, such as menu.File.Open. (required)
    format="..." Format with supported variables:
    $name for variable name
    $value for variable value
    $isdefined expanding to 1 or 0 depending if variable is defined or not
    $isset expanding to 1 or 0 depending if variable is logically true or false
    $ispersistent expanding to 1 or 0 depending if variable is persistent or not
    • all FormatTokens such as $dollar, $n, $percnt.
    "$value"
    default="..." Text shown if variable is not defined, e.g. not found. This parameter overrides the format parameter. "" (empty string)
    store="..." Specify a store name that holds the persistent variable. This assumes the variable was previously set with the same store name. ""
  • Example: %GET{"lunch"}% returns Sushi if the following has been previously set:
    %SET{ "lunch" value="Sushi" }% - see more examples
  • JSON Syntax: %GET{ name }% - see description.
  • Example to set a JSON object and to get a JSON object with a JSON path:
    • %SET{ menu = { "File": { "New": [ "new", "F" ], "Open": [ "open", "F" ] }, "Edit": { "Copy": [ "cpy", "F" ], "Paste": [ "pst", "F" ] } } }% - set a JSON object
    • %GET{ menu.File.Open }% - returns: ["open","F"]
  • Category: ApplicationsAndComponentsVariables, DevelopmentVariables
  • Related: IF, SET, SETGETDUMP, SetGetPlugin, SpreadSheetPlugin#FuncGET (this topic)

JIRAREST{"..."} -- call JIRA issue tracker using REST API

  • Interface to the Atassian JIRA issue tracker via JIRA REST API call. The %JIRAREST{}% variable is handled by the JiraRestPlugin.
  • Syntax: %JIRAREST{ "..." command="..." }%
  • Parameters:
    Parameter Description Default
    "..." or
    action="..."
    Action to take. This is the REST method: "get" for GET, "put" for PUT, "post" for POST, and "delete" for DELETE method. "" (no action)
    command="..." REST command, such as: "/rest/api/2/issue/TEST-1" (required)
    data="..." Request body sent with REST call, such as: " { \"id\": \"10009\" } " (required for put
    and post actions)
    action2="..."
    command2="..."
    data2="..."
    Conduct a second action after successful execution of the first action. Use this to do multiple REST API calls in one session. No action is taken if there was an error in the first action.
    In the same way, action3, action4, etc can be executed.
    (optional)
    user="..." User for REST call; default is configure setting {Plugins}{JiraRestPlugin}{User} (configure setting)
    password="..." Password for REST call; default is configure setting {Plugins}{JiraRestPlugin}{Password} (configure setting)
  • Example: %JIRAREST{ "get" command="/rest/auth/1/session" }% - see more examples.
  • Category: ApplicationsAndComponentsVariables, DatabaseAndFormsVariables, DevelopmentVariables, ImportVariables, WorkflowAndAutomationVariables
  • Related: JiraRestPlugin (this topic)

JQPLOT -- add line, bar and pie charts using jqPlot JavaScript library

LDAP{"filter" format="format"} -- LDAP directory query

  • An interface to query an LDAP directory and display the results in a TWiki topic
  • Syntax: %LDAP{"filter" format="format" ...}%
  • Supported parameters:
    Parameter: Description: Default:
    "uid=joeshmoe" the LDAP query string required
    filter="uid=joeshmoe" (Alternative to above) N/A
    host="..." host IP or name to connect to  
    port="..." port to of the host  
    version="..." protocol version; possible values: 2,3  
    ssl="..." use ssl to bind to the server; possible values 0,1  
    base="..." base dn of the (sub)tree to search in; if base is written in brackets (e.g. 'base="(ou=people)"') then it is prepended to the default base the default base of the LdapContrib
    scope="one" scope of search; possible values: sub, base, one sub
    format="..." format string used to display a database record $dn
    header="..." header to prepend the output no header
    footer="..." footer to appended to the output no footer
    sep="..." or separator="..." separator between database records $n (new line)
    sort="..." name of attributes to sort the output DN
    reverse="on" reverse the result set; possible values: on, off off
    limit="100" maximum number of records to return no limit
    skip="10" number of records in the hit set to skip before displaying them 0 (nothing is skipped)
    required="..." a comma separated list of LDAP record attributes. If specified, the LDAP query results not having all of the specified attributes are eliminated nothing is required
    hidenull="on" wether to hide any output on an empty hit set; possible values: on, off off
    default="..." when the LDAP query yields no results, the value of this parameter is returned as the search result instead of null. Naturally, if hidenull is on, default doesn't have any effect "" (null string)
    clear="..." comma separated list of attributes to be removed from the output if they are not resolved nothing is cleared
  • The header, format and footer format strings may contain the following variables and the standard special tokens:
    Variable: Description:
    $count the number of hits
    $index the record number
    $<attr-name> the value of the record attribute <attr-name>
  • Example: %LDAP{"objectClass=posixAccount" format="| $index | $cn | $mail |"}%
  • Category: DevelopmentVariables, DatabaseAndFormsVariables, SearchingAndListingVariables
  • Related: LDAPUSERS, LdapNgPlugin, LdapContrib (this topic)

LDAPUSERS{...} -- LDAP user information

  • List all LDAP user information. Information is drawn from cache and not from the LDAP server. Use ?refreshldap=on to update.
  • Supported parameters:
    Parameter: Description: Default:
    format="..." format string used to display a user record ordered list of $displayName
    header="..." header to prepend the output no header
    footer="..." footer to appended to the output no footer
    sep="..." separator between database records $n (new line)
    limit="100" maximum number of records to return no limit
    skip="10" number of records in the hit set to skip before displaying them 0 (nothing is skipped)
    include="..." regular expression a user's WikiName must match to be included in the output  
    exclude="..." regular expression a user's WikiName must not match  
    hideunknown="off" on/off, enable/disable filtering out users that did not log in yet and thus have no home topic (e.g. created by TWiki:Plugins/NewUsersPlugin) on
  • The header, format and footer format strings may contain the following variables and the standard special tokens:
    Variable: Description:
    $index the record number
    $wikiName the user's WikiName
    $loginName the user's login name
    $displayName a link pointing to the users home topic in the Main web, if it exists, and '<nop>$wikiName' otherwise
    $emails the list of all known email addresses
  • Example: %LDAPUSERS{limit="10"}%
  • Category: DevelopmentVariables, DatabaseAndFormsVariables, SearchingAndListingVariables
  • Related: LDAPUSERS, LdapNgPlugin, LdapContrib (this topic)

LOADAPP{"id"} -- Load TWiki application code from a hidden web

PING{ host="..." } -- ping a host for reachability

  • The %PING{}% variable tests if a remote host identified by host name or IP address is reachable via ping command. The variable is handled by the PingPlugin.
  • Syntax: %PING{ host="www.google.com" }%
  • Supported attributes:
    Attribute Comment Default
    host="..." Host name or IP address (required)
    wait="..." Time, in seconds, to wait for a ping response "5"
    format="..." Format of output. Use the variables $host for the host and $result for the result (1 for success, 0 for failure) For success: "%GREEN%host%ENDCOLOR%"
    For failure: "%RED%host%ENDCOLOR%"
  • Example: %PING{ host="www.google.com" wait="2" }%
  • Category: AdministrationVariables, DevelopmentVariables, SystemInformationVariables
  • Related: PingPlugin (this topic)

SENDMAIL{...} -- send e-mail from actions in TWiki topics, useful for workflow automation

  • The %SENDMAIL{}% variable is handled by the SendMailPlugin.
  • Syntax: %SENDMAIL{ action="send" ... }%
  • Parameters:
    Parameter Description Default
    action="" Only action="send" is supported, it will send an e-mail "" (no action)
    excludetopic="MyTemplate" Exclude action for named topic. Typically used in a template topic containing the SENDMAL variable to disable the action when viewing the topic. "" (no exclude)
    from="admin@example.com" E-mail address or WikiName of sender. If a WikiName is specified, the registered e-mail of that person is used. Supported tokens:
    $webmastername - name of TWiki administrator.
    $webmasteremail - e-mail of TWiki administrator.
    $username - WikiName of logged in user.
    $useremail - e-mail address of the logged in user.
    Defaults to TWiki administrator. See note on open mail relay.
    "$webmastername <$webmasteremail>"
    to="jom@example.com" To list: Comma-space delimited list of e-mail addresses or WikiNames of adressees. Same tokens supported as in from="". Defaults to TWiki administrator. "$webmastername <$webmasteremail>"
    cc="jimmy@example.com" CC list: Comma-space delimited list of e-mails or WikiNames. Same tokens supported as in from="". ""
    bcc="boss@example.com" BCC list: Comma-space delimited list of e-mails or WikiNames. Same tokens supported as in from="". ""
    subject="Any text" E-mail subject. Text may include TWikiVariables such as %URLPARAM{subject}%, and format tokens such as $n and $percnt. (help message)
    text="Any text" or
    plaintext="Any text"
    E-mail body in plain text format. Text may include TWikiVariables and format tokens. (help message)
    htmltext="Any HTML" E-mail body in HTML format, optional. Text may include TWikiVariables and format tokens. Double quotes need to be escaped, such as <a href=\"http://twiki.org/\">TWiki.org<a>. A MIME Multi-Part message is sent if both, plaintext and htmltext are specified. ""
    onsuccess="..." Text shown in place of the SENDMAIL variable on success, default is empty. Text may include TWikiVariables and format tokens. ""
    onerror="| $error ||" Error message shown in place of the SENDMAIL variable on error, if any. Text may include TWikiVariables and format tokens. Token $error expands to the error message. "$error"
  • Security: See note on how to avoid an open mail relay
  • Example:
    %SENDMAIL{ action="send" to="$username <$useremail>" subject="Status change" text="Status changed to %FORMFIELD{Status}%" }%
  • Category: DevelopmentVariables, EmailAndNotificationVariables, WorkflowAndAutomationVariables
  • Related: SendMailPlugin (this topic)

SET{"name" value="..."} -- set a variable

  • Set a named variable that can be retrieved later with %GET{}%. No output is shown, e.g. %SET{}% resolves to an empty string. It is also possible to set a JSON object using a JSON path. The %SET{}% and %GET{}% variables are handled by the SetGetPlugin.
  • Syntax: %SET{ "name" value="..." remember="1" }%
  • Parameters:
    Parameter Description Default
    "name" Name of variable. Alphanumeric characters, dashes and underscores can be used. (required)
    value="..." Value of variable. Escape double quotes with backslash. (required, may be empty)
    remember="1" If set, the variable will be stored persistently so that it can be used later in any TWiki topic. Alternatively use the store parameter. See important notes. "0"
    store="..." Specify a store name to persistently store the variable, such as store="Parts". Use alphanumeric characters, dashes and underscores for the name. For better performance, store is preferred over the remember parameter if you need to store a large dataset. See important notes. ""
  • Example: %SET{"lunch" value="Sushi"}% - see more examples.
  • JSON Syntax: %SET{ name = { ... } remember="1" }% - see description.
    • An optional remember="1" or store="..." parameter can be appended. If specified, the JSON object will be stored persistently so that it can be used later in any TWiki topic.
  • Example to set, modify and get a JSON object:
    • %SET{ menu = { "File": { "New": [ "new", "F" ], "Open": [ "open", "F" ] }, "Edit": { "Copy": [ "cpy", "F" ], "Paste": [ "pst", "F" ] } } }% - set a JSON object
    • %GET{ menu }% - returns: {"File":{"New":["new","F"],"Open":["open","F"]},"Edit":{"Copy":["cpy","F"],"Paste":["pst","F"]}}
    • %SET{ menu.File.Open[1] = "T" }% - modify a JSON object
    • %GET{ menu }% - returns: {"File":{"New":["new","F"],"Open":["open","T"]},"Edit":{"Copy":["cpy","F"],"Paste":["pst","F"]}}
    • %SET{ menu.Edit.Cut = [ "cut", "T" ] }% - add to a JSON object
    • %GET{ menu }% - returns: {"File":{"New":["new","F"],"Open":["open","T"]},"Edit":{"Copy":["cpy","F"],"Paste":["pst","F"],"Cut":["cut","T"]}}
  • Category: ApplicationsAndComponentsVariables, DevelopmentVariables
  • Related: GET, IF, SETGETDUMP, SetGetPlugin, SpreadSheetPlugin#FuncSET (this topic)

SETGETDUMP{...} -- dump variables

USERREPORT -- show user reports with profile pictures

  • Show various user reports documented in UserReports
  • Syntax: %USERREPORT{ action="..." ... }%
  • Overview of actions with parameters:
    Report action= Parameters
    Show a simple list of registered users "user_list" search, limit, sort, reverse
    Show the profile picture image of a user "profile_picture" user, height, width, title
    Show slim, one line height user boxes "slim_box_start"
    "slim_box" or
    "slim_box_list"
    "slim_box_end"
    style
    user, style
    users, style
    none
    Show small, two line height user boxes "small_box_start"
    "small_box" or
    "small_box_list"
    "small_box_end"
    style
    user, style
    users, style
    none
    Show users in business card format "business_card_start"
    "business_card" or
    "business_card_list"
    "business_card_end"
    style
    user, style
    users, style
    none
    Show a selector to pick a user,
    for use in HTML forms
    "select_one_user" name, selected, users
    Show rows of checkboxes to select users,
    for use in HTML forms
    "select_users" name, selected, users, colums, style
  • Example: %USERREPORT{ action="user_list" search="jane" limit="5" }%
  • Category: AdministrationVariables, DevelopmentVariables, UsersAndAuthenticationVariables
  • Related: BUBBLESIG, SEARCH, USERSIG, UserList, UserReports (this topic)

VARCACHE{ attributes } -- cache TWiki variables in selected topics for faster page rendering

  • The %VARCACHE{}% variable is handled by the VarCachePlugin.
  • Syntax: %VARCACHE{ "24" }%
  • Supported attributes:
    Attribute Comment Default
    "..." or
    refresh="..."
    Cache refresh period in hours (maximum age of cache) REFRESH setting
    cachemsg="..." Message shown when looking at a cached topic. Use $age to indicate the age of cache, $link to indicate the refresh URL CACHEMSG setting
    updatemsg="..." Message shown after a cache refresh. Use $link to indicate the refresh URL UPDATEMSG setting
  • Example: %VARCACHE{"168"}% caches the current page for 7 days
  • Exclude variables from getting cached:
    • Use <varcache_exclude> ... </varcache_exclude> to exclude sections of a page
      • Example: <varcache_exclude> %SEARCH{...}% </varcache_exclude> runs the search on every page view, regardless of caching
    • Or, prefix variables with VARCACHE_EXCLUDE_
      • Example: %VARCACHE_EXCLUDE_WIKIUSERNAME% renders the WIKIUSERNAME variable on every page view, regardless of caching
  • Category: AdministrationVariables, DevelopmentVariables
  • Related: VarCachePlugin, VarCachePluginTest (this topic)

Total: 21 variables

Related Topics: TWikiVariables, TWikiVariablesSearch, TWikiVariablesQuickStart

Topic revision: r1 - 2012-11-11 - TWikiContributor
 
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2017 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.