LUA object: program

The object represents the program.

AvailabilityGlobal object, available in all scripts
Pre-initialized inAll scripts
clienttype = program.type()
if clienttype == 1 then
   output.print("Client windows")
else
   output.print("Other client")
end

dismisspresentation

DescriptionCloses a web window based on its identifier
Value Type
Formatprogram.dismisspresentation(identifier)
TypeMethod
Systems
ParameterValue TypeDescription
identifierstringThe identifier of the window to be closed

forcesync

DescriptionIf the current database is a cloud database, forces synchronization with the server
Value Type
Formatprogram.forcesync()
TypeMethod
SystemsWindows, Web, Android, IOS, Mac OS
Examples
program.forcesync()

geocoding

DescriptionGiven an address, the system returns the normalized address using the Google Maps service and its geographic coordinates
Value Typelist<list<object>>
Formatlist<list<object>> = program.geocoding(address)
TypeMethod
SystemsWindows, Web, Android, IOS, Mac OS
ParameterValue TypeDescription
addressstringThe complete address to send
Examples
address = program.geocoding("via genova 12,41012 Carpi Modena Italy")

geocodingreverse

DescriptionConverts a latitude and longitude into a real address using the Google Maps service
Value Typelist<string>
Formatlist<string> = program.geocodingreverse(lat, lng)
TypeMethod
SystemsWindows, Web, Android, IOS, Mac OS
ParameterValue TypeDescription
latdoubleThe latitude of the geographic coordinate
lngdoubleThe longitude of the geographic coordinate
Examples
address = program.geocodingreverse(-1,-1)

geolocation

DescriptionOnly for mobile systems, returns the GPS coordinates of the device
Value Typelist<double>
Formatlist<double> = program.geolocation()
TypeMethod
SystemsWindows, Web, Android, IOS, Mac OS
Examples
coordinates = program.geolocation()

getcarttable

DescriptionRetrieves the cart management table associated with a specific data table
Value Typecarttable
Formatcarttable = program.getcarttable(tablename)
TypeMethod
SystemsWeb, Android, IOS
ParameterValue TypeDescription
tablenamestringThe name of the table associated with the cart

getownerid

DescriptionReturns the unique identifier of the user who owns the current database
Value Typesingle
Formatsingle = program.getownerid()
TypeMethod
SystemsWindows, Web, Android, IOS, Mac OS
Examples
id = program.getownerid()

getownerusername

DescriptionReturns the name of the user who owns the current database
Value Typestring
Formatstring = program.getownerusername()
TypeMethod
SystemsWindows, Web, Android, IOS, Mac OS
Examples
username = program.getownerusername()

getparam

DescriptionRetrieves a value from the global space of the program based on a key
Value Typeobject
Formatvalue = program.getparam(key)
TypeMethod
SystemsWindows, Web, Android, IOS, Mac OS
ParameterValue TypeDescription
keystringThe key of the value

getstringuserid

DescriptionReturns the unique identifier of the current user in string format
Value Typestring
Formatstring = program.getstringuserid()
TypeMethod
SystemsWindows, Web, Android, IOS, Mac OS
Examples
stringid = program.getstringuserid()

getusercategory

DescriptionReturns the category of the current user in bitwise format
Value Typedouble
Formatdouble = program.getusercategory()
TypeMethod
SystemsWindows, Web, Android, IOS, Mac OS
Examples
category = program.getusercategory()

getuserid

DescriptionReturns the unique identifier of the current user
Value Typeinteger
Formatinteger = program.getuserid()
TypeMethod
SystemsWindows, Web, Android, IOS, Mac OS
Examples
id = program.getuserid()

getusername

DescriptionReturns the email or name of the current user
Value Typestring
Formatstring = program.getusername()
TypeMethod
SystemsWindows, Web, Android, IOS, Mac OS
Examples
username = program.getusername()

insertcart

DescriptionFor mobile versions, inserts a record reference inside the cart for order creation
Value Type
Formatprogram.insertcart(tablename, gguid, gguidvariant, qta)
TypeMethod
SystemsWeb, Android, IOS, Mac OS
ParameterValue TypeDescription
tablenamestringThe table containing the record to be inserted into the cart
gguidstringThe unique identifier of the record to be inserted into the cart
gguidvariantstringThe unique identifier of the possible sub-variant of the record to be inserted into the cart
qtasingleThe quantity to be inserted in the cart

isallowed

DescriptionChecks whether the current user belongs to a category
Value Typeboolean
Formatboolean = program.isallowed(permission)
TypeMethod
SystemsWindows, Web, Android, IOS, Mac OS
ParameterValue TypeDescription
permissiondoubleThe permission in bitwise format to be checked

isallowedcategory

DescriptionChecks whether a permission value is present within a bitwise category
Value Typeboolean
Formatboolean = program.isallowedcategory(permission, categories)
TypeMethod
SystemsWindows, Web, Android, IOS, Mac OS
ParameterValue TypeDescription
permissiondoubleThe permission to check
categoriesdoubleThe bitwise value to check against

listlocalusers

DescriptionReturns the complete list of both cloud and local users who can access the current database
Value Typelist<string>
Formatlist<string> = program.listlocalusers()
TypeMethod
SystemsWindows, Web, Android, IOS, Mac OS

listnamedatabases

DescriptionReturns the list of available database names
Value Typelist<string>
Formatlist<string> = program.listnamedatabases()
TypeMethod
SystemsWindows, Web, Android, IOS, Mac OS

listpathdatabases

DescriptionReturns the list of paths of currently available database files in the system
Value Typelist<string>
Formatlist<string> = program.listpathdatabases()
TypeMethod
SystemsWindows, Web, Android, IOS, Mac OS

loadspreadsheet

DescriptionLoads a file in Excel or CSV format and converts it into a datatable object
Value Typedatatable
Formatprogram.loadspreadsheet(pathfile)
TypeMethod
SystemsWindows
ParameterValue TypeDescription
pathfilestringThe path of the file

newdataform

DescriptionCreates a new dataform object
Value Typedataform
Formatdataform = program.newdataform()
TypeMethod
SystemsWindows, Web, Android, IOS, Mac OS

newdatauser

DescriptionCreates a new datauser object
Value Typedatauser
Formatdatauser = program.newdatauser(username)
TypeMethod
SystemsWindows, Web, Android, IOS, Mac OS
ParameterValue TypeDescription
usernamestringThe email or username to use for creating the datauser object

newdataview

DescriptionCreates a new dataview object
Value Typedataview
Formatdataview = program.newdataview(tablename, gguid)
TypeMethod
SystemsWindows
NotesIf no gguid is passed, a dataview for a new record is created
ParameterValue TypeDescription
tablenamestringThe name of the table
gguidstringThe gguid of the record to load

newemail

DescriptionCreates a new email object
Value Typeemail
Formatemail = program.newemail()
TypeMethod
SystemsWindows, Web, Android, IOS, Mac OS

newemailv2

DescriptionCreates a new emailv2 object
Value Typeemailv2
Formatemailv2 = program.newemailv2()
TypeMethod
SystemsWindows, Web, Android, IOS, Mac OS

newfileinfo

DescriptionCreates a new fileinfo object
Value Typefileinfo
Formatfileinfo = program.newfileinfo(pathfile)
TypeMethod
SystemsWindows, Web, Android, IOS, Mac OS
ParameterValue TypeDescription
pathfilestringThe file path to use in order to create the fileinfo object

newformtable

DescriptionCreates a new formtable object
Value Typeformtable
Formatformtable = program.newformtable()
TypeMethod
SystemsWindows, Web, Android, IOS, Mac OS

newnotification

DescriptionCreates a new notification object
Value Typenotification
Formatnotification = program.newnotification()
TypeMethod
SystemsWindows, Web, Android, IOS, Mac OS

newsubscript

DescriptionCreates a subscript object
Value Typesubscript
Formatsubscript = program.newsubscript(gguidscript)
TypeMethod
SystemsWindows, Web, Android, IOS, Mac OS
ParameterValue TypeDescription
gguidscriptstringThe gguid of the script to load
Examples
program.setparam("VALUE1","1")
script_example = program.newsubscript("GGUID SCRIPT")
script_example.execute()

newxmldocument

DescriptionCreates a new xmldocument object
Value Typexmldocument
Formatxmldocument = program.newxmldocument()
TypeMethod
SystemsWindows, Web, Android, IOS, Mac OS

opensection

DescriptionThe method opens a specific section of the program by using its gguid to identify it
Value Type
Formatprogram.opensection(gguidsection)
TypeMethod
SystemsWindows, Web, Android, IOS, Mac OS
ParameterValue TypeDescription
gguidsectionstringThe gguid of the section to open

openurl

DescriptionOpens the system browser to load an internet page
Value Type
Formatprogram.openurl(url)
TypeMethod
SystemsWindows, Web, Android, IOS, Mac OS
ParameterValue TypeDescription
urlstringThe URL address to open

refreshpresentation

DescriptionForces the update of a web window based on its identifier
Value Type
Formatprogram.refreshpresentation(identifier)
TypeMethod
Systems
ParameterValue TypeDescription
identifierstringThe identifier of the window to be updated

refreshsection

DescriptionForces the update of all sections in the program that use a specific table
Value Type
Formatprogram.refreshsection(tablename)
TypeMethod
SystemsWindows, Web, Android, IOS, Mac OS
ParameterValue TypeDescription
tablenamestringThe name of the table used in the section to be updated

searchdatauser

DescriptionCreates a datauser object using the user’s name, full name, or initials
Value Typedatauser
Formatdatauser = program.searchdatauser(value)
TypeMethod
SystemsWindows, Web, Android, IOS, Mac OS
ParameterValue TypeDescription
valuestringThe value to search for

setparam

DescriptionSaves a value in a global space of the program
Value Typeobject
Formatprogram.setparam(key, value)
TypeMethod
SystemsWindows, Web, Android, IOS, Mac OS
ParameterValue TypeDescription
keystringThe key of the value
valueobjectThe value to save in the parameter

showconfirm

DescriptionDisplays a confirmation message
Value Type
Formatprogram.showconfirm(message)
TypeMethod
SystemsWindows, Web, Android, IOS, Mac OS
ParameterValue TypeDescription
messagestringThe message to display

showdataview

DescriptionOpens a form based on a table and a record
Value Type
Formatprogram.showdataview(tablename, gguid)
TypeMethod
SystemsWindows, Web, Android, IOS, Mac OS
ParameterValue TypeDescription
tablenamestringThe table containing the record to be loaded
gguidstringThe unique identifier of the record to be loaded

showerror

DescriptionShows an error message
Value Type
Formatprogram.showerror(message)
TypeMethod
SystemsWindows, Web, Android, IOS, Mac OS
ParameterValue TypeDescription
messagestringThe message to display

showhtml

DescriptionDisplays a window containing an HTML page
Value Type
Formatprogram.showhtml(html, style, identifier)
TypeMethod
Systems
NotesThe HTML follows the Nios4 encoding rules for handling the various actions
ParameterValue TypeDescription
htmlstringThe HTML to be displayed within the window
styleintegerIdentifies the window size
identifierstringThe identification key of the window

showinputbox

DescriptionDisplays a form for entering a text value
Value Typestring
Formatstring = program.showinputbox(title, defaultvalue, ispassword)
TypeMethod
SystemsWindows, Web, Android, IOS, Mac OS
ParameterValue TypeDescription
titlestringThe title to be displayed in the form
defaultvaluestringThe default value to display
ispasswordbooleanIf the value must be hidden as a password or not

showlogin

DescriptionOpens the login window
Value Type
Formatprogram.showlogin()
TypeMethod
SystemsWindows, Web, Android, IOS, Mac OS

showmessagebox

DescriptionDisplays a form containing a message or a question
Value Typeinteger
Formatinteger = program.showmessagebox(title, stylebutton, styleicon)
TypeMethod
SystemsWindows, Web, Android, IOS, Mac OS
ParameterValue TypeDescription
titlestringThe title to be displayed inside the message
stylebuttonintegerThe type of buttons to display: 1 ok, 2 ok cancel, 3 yes no, 4 yes no cancel
styleiconintegerThe type of icon to display: 1 info, 2 question, 3 critical, 4 error

showwarning

DescriptionShows an alert message
Value Type
Formatprogram.showwarning(message)
TypeMethod
SystemsWindows, Web, Android, IOS, Mac OS
ParameterValue TypeDescription
messagestringThe message to display

type

DescriptionIndicates the type of device used
Value Typeinteger
Formatinteger = program.type()
TypeMethod
SystemsWindows, Web, Android, IOS, Mac OS

useradmin

DescriptionRetrieves the value to check if the current user is an administrator or not
Value Typeboolean
Formatboolean = program.useradmin()
TypeMethod
SystemsWindows, Web, Android, IOS, Mac OS

useranonymous

DescriptionRetrieves the value to check if the user is anonymous or not
Value Typeboolean
Formatboolean = program.useranonymous()
TypeMethod
SystemsWindows, Web, Android, IOS, Mac OS

userdisplayname

DescriptionRetrieves the full name of the current user, if filled in
Value Typestring
Formatstring = program.userdisplayname()
TypeMethod
SystemsWindows, Web, Android, IOS, Mac OS

usereasy

DescriptionRetrieves the value to check if the current user is registered as an easy or standard user
Value Typeboolean
Formatboolean = program.usereasy()
TypeMethod
SystemsWindows, Web, Android, IOS, Mac OS

userinitials

DescriptionRetrieves the initials of the current user, if filled in
Value Typestring
Formatstring = program.userinitials()
TypeMethod
SystemsWindows, Web, Android, IOS, Mac OS

usertoken

DescriptionRetrieves the authentication token from the Nios4 server if available
Value Typestring
Formatstring = program.usertoken()
TypeMethod
SystemsWindows, Web, Android, IOS, Mac OS