8.18/6/2018

Getmeta (function)

Returns the value of a metadata attribute or field.

Syntax

getmeta(name: string; [flags : integer; path : string]) string

Arguments

name

The name of the metadata value to retrieve. Unless the GetAttribute flag argument is specified, the function looks for the name in the field collection.

flags

Optional integer value to define the behavior of the command when a field with the same name already exists in the current level.  The flag value to enter should be the sum of all desired flags. (Eg: GetAttribute and FailIfNotFound would give a flag value of '5').

The default behavior uses 0.

Name Value Behavior
GetAttribute 1 Search for the name argument in the attribute collection
instead of the default field collection.
NoCascade
2 Search only the level specified by the path argument
(defaults to Page level when path argument is empty),
instead of default behavior, going from the Page level to
the Job level.
FailIfNotFound
4 Raise an error and crash the job is the specified name is
not found instead of returning an empty string.
SelectedNodesOnly
8 Returns values from the selected nodes only.

path

Optional string value to specify the level where to start looking for the field or attribute. Path components cannot be indexed, and if no path

is provided, the search is done from the the Page level.

Note: The node names of the path argument can have an optional zero-based index, indicated between square brackets ('[ ]'), to access a specific node. If no index is provided, the first node is used.

Important Note: If used from PlanetPress Suite Workflow Tools, every argument is mandatory.

Code Sample Example

These examples show the three different syntaxes for the GetMeta() function.



% Retrieve value for field "mydata". If that field exists in both the current group and the current datapage collections, for instance,
% this call to the GetMeta() function will return the value of the field from the datapage.
GetMeta('mydata')



% Retrieve the second value of the current page, containing two fields called "address", while the group collection also has four "address" fields.
GetMeta('address[1]')



% Note that using GetMeta('address[2]') would return the third value of the group level. To prevent the function from cascading up to the group level, 
% the NoCascade flag must be provided. And to retrieve the first two "address" fields of the group collection, the third argument must be used, set to 
% the proper path, thusly:
GetMeta('address[1]', 2, 'Job.Group')