Octiv Document Scripting allows you to call methods to manipulate variable data within a document. Reference this article on Document Scripting for background information on how it works.

The following table shows you which methods are supported in Octiv.

Method Example Result
as_img {{image_variable.as_img}} where image_variable contains a URL for the image Image displayed
to_i {{number_variable.to_i}} where number_varialbe = 1000.0 1000
{{“23.to_i}} this statement makes Octiv interpret the stirng “23” as a number 23
number to currency {{number_to_currentcy(number_variable)}} where number_variable is the variable name and has a value of 1000.32 $1,000.32
change the currency unit {{number_to_currency(second_number, :unit=>”&pound” )}} £1,000.32
change the delimiter {{number_to_currency(second_number, :delimiter=>”.”)}} $1.000.32
change the currency unit and delimiter {{number_to_currency(second_number, :delimiter=>’.’, :unit=>’¢’ )}} ¢1.000.32
change the number of decimal places {{number_to_currency(second_number, :precision=>1)}} $1,000.3
gsub {{“Hello”.gsub(“l”, “*”)}} He**o
sub {{“Hello”.sub(“l”, “*”)}} He*lo
include {{“string”.include?(“substring”)}} false
{{“substring”.include?(“string”)}} true

Notes about using Document Scripting method statements:

  • Ensure all variables are lowercase
  • Be sure to use double curly brackets {{}} to open and close method statements. Do not use {{=.

Some finer points about sub vs. gsub:

  • The Octiv application is coded using Ruby; in the Ruby language, g stands for global.
  • sub will replace only the first occurrence, whereas gsub will replace all occurrences.
  • sub and gsub have equivalent Java methods — replace and replaceAll

Did this article help?

Please provide us your feedback below.

* How helpful was this article?

If you have any additional questions and would like to be contacted by a member of our support team, please provide your email.