Menu

Perl API Log in to Edit

Perl API

You can retrieve Perl API from the web Administration menu of each database, under the Documentation section.

These are Perl functions that can be called in Woda parameters that allow expressions. In Perl you call functions like this:

&myFunction(parameter1,parameter2);

DECODE($fld,$val,$short)

  • decodes the value from an 'OPTION' or 'LINKOPTION' list so that full text is visible
  • $short ... returns decoded value only!
  • usage: "&DECODE()" (without parameters) in the picture setting of a field ; it is assummed that the value is in '$_' and the field is '$field'

FETCH($url)

  • fetches '$url' and returns the part of page between 'a name=PAGEBODYN' tags or whole page if that is not found
  • this function may not work on some windows httpd servers (IIE, Xitami)

FLD($table,$id,$name)

  • get a value of field '$name' of record '$id' from table '$table'
  • '$table' must be defined in '$WBB{'tables'}'

GET($table,$id)

  • like recRead but works with any table, even remote one
  • returns hash
  • includes ALL fields, including password

ID($string)

  • modifies '$string' so that it can be used as a record ID e.g. replaces dots with underscore

IDS($table)

  • return array of all IDs in a given table
  • does it through ROWS because ROWS can do http

KEY($id,$table)

  • is there a record with 'id=$id' in table '$table' ?

LINK($table,$id,$text)

  • return a link to a record with 'id=$id' in table '$table'.
  • if '$text' is supplied, that text is linking, otherwise the '$id' is linking.
  • if '$id' is not specified, the value in '$_' is assumed to hold the id
  • typically used in 'picture' field definitions to make pointers to a related table
  • usage:
$WBB{$x,picture}='&LINK("people",$_,"lastName");

NEXT($first,$step)

  • returns next free ID in this table

NOOP()

  • does nothing at all

OLDQRY($table,$search,$then,$sort,$format,$first,$max,$flds)

  • This is obsolete!
  • Performs a search in table '$table' and returns results formatted in HTML
  • parameters correspond to CGI parameters of standard or advanced search
  • Fails on some Windows Web servers such as IIE that don't let you call another Perl program.
  • Run Debug info from Admin menu to check if it has a chance of working.

PIC($dFields)

  • formats values in' %rec' hash into '%pic' hash, using instructions in '$WBB{field,'picture'}'
  • only does it for comma separated list (no spaces) of 'dFields', if defined
  • returns the PIC of the last field

PUT($table)

  • puts '%rec' into table '$table'

PUTN($othertable,$search,$then)

  • puts several records from this table to another table
  • '$search' and '$then' are same as in QRY

QRY($table,$search,$then,$sort,$format,$first,$max,$flds)

  • Does the same as OLDQRY but uses HTTP to get the data

RELATED($table,$flds,$search)

  • provides a decently formated related data from another table
  • is fast * uses ROWS function
  • may provide a small toolbar too
  • WARNING automatically adds '$_id' as first field
  • only the table and search parameters need to be specified

ROWS($table,$flds,$search,$then,$sort,$format,$first,$max)

  • get raw data (tab separated) from '$table'
  • similar to QRY function with '$format=RAW'
  • '$flds' are comma separated field name
  • does not take into account any setting of table '$table' unless table is empty and the function works on the local table

TODAY()

  • returns today's date formatted in a way proper for Woda date field

URL()

  • returns URL of a given service

Related

Documentation Wiki: AdministratorManual