Index

(misc)

o2val

mix o2val(string $view_name, string $field_name)

Returns current value of a field in a view, program or application variable.
When the view is a db-view it must be defined in the program where o2val() is used and the field must be a field defined in that view.

To get a program-variable value pass JX_VIRT_VIEW as view name.
To get an application (session) variable pass "_o2SESSION" as view name.

If returned value is an array, indexed subvalues can be retrieved passing indexes as supplementary parameters. For example if you have:
o2val("view", "field") = array(1 => array("c" => "value"))
you can get "value" directly by calling:
o2val("view", "field", 1, "c")

If returned value is a Date or Time format, single parts of the value can be retrieved passing a single letter as supplementary parameter:
"y"=Year(2 digits), "Y"=Year(4 digits), "m"=Month, "d"=Day, "h"=Hours, "i"=Minutes and "s"=Seconds.
Excepted "y/Y" paramter for year, all other letters are key-unsensitive.
For example if you have:
o2val("view", "field") = (Date)"20130531" (31/05/2013)
you can get the month value directly by calling:
o2val("view", "field", "m")
or if you have
o2val("view", "field") = (Time)"184510" (18:45:10)
you can get the hours value directly by calling:
o2val("view", "field", "h")


Parameters:
  1. $view_name
  2. Name of the db-view or JX_VIRT_VIEW or "_o2SESSION"
  3. $field_name
  4. Name of the field or variable
Related functions:

o2pre

o2zero

o2par

o2format