LUA object: dataform

The object represents a temporary form for retrieving information from the user.

AvailabilityThe object is returned by a method or a property of another object
form = program.newdataform()
form.settitle("Find customer")
form.addfieldtext("Name","NAMECUSTOMER","")
form.show()

if form.closewithx == true then
   --exit to script
   do return end
end

table = database.getsql("SELECT * FROM customer WHERE nome='" .. form.getvalue("NAMECUSTOMER") .. "'")

if table.countrows() > 0 then
   program.showconfirm("Customer found")
else
   program.showerror("Customer not found")
end

addfielddate

DescriptionAdds a field for entering a date
Value Type
Formatdataform.addfielddate(caption, tag, defaultvalue)
TypeMethod
SystemsWindows, Web, Android, IOS, Mac OS
ParameterValue TypeDescription
captionstringRepresents the field label
tagstringRepresents the unique identifier of the field to retrieve or set its value
defaultvalueobjectThe default value to be set during the creation of the field
Examples
dataform.addfielddate("Start Date","start",utility.getnow())

addfieldinteger

DescriptionAdds a field for entering an integer number
Value Type
Formatdataform.addfieldinteger(caption, tag, defaultvalue)
TypeMethod
SystemsWindows, Web, Android, IOS, Mac OS
ParameterValue TypeDescription
captionstringRepresents the field label
tagstringRepresents the unique identifier of the field to retrieve or set its value
defaultvalueobjectThe default value to be set during the creation of the field
Examples
dataform.addfieldinteger("Number of days","numberday",1)

addfieldlist

DescriptionAdds a field for selecting a value from a defined list
Value Type
Formatdataform.addfieldlist(caption, tag, values, defaultvalue)
TypeMethod
SystemsWindows, Web, Android, IOS, Mac OS
ParameterValue TypeDescription
captionstringRepresents the field label
tagstringRepresents the unique identifier of the field to retrieve or set its value
valueslist<string>The strings that will populate the list
defaultvalueobjectThe default value to be set during the creation of the field
Examples
dataform.addfieldlist("Select Day","selectday",{"Monday","Tuesday","Wednesday"},"Monday")

addfieldnumber

DescriptionAdds a field for entering a number with decimals
Value Type
Formatdataform.addfieldnumber(caption, tag, defaultvalue)
TypeMethod
SystemsWindows, Web, Android, IOS, Mac OS
ParameterValue TypeDescription
captionstringRepresents the field label
tagstringRepresents the unique identifier of the field to retrieve or set its value
defaultvalueobjectThe default value to be set during the creation of the field
Examples
dataform.addfieldnumber("Quantity","qty",1.5)

addfieldtext

DescriptionAdds a field for text input
Value Type
Formatdataform.addfieldtext(caption, tag, defaultvalue)
TypeMethod
SystemsWindows, Web, Android, IOS, Mac OS
ParameterValue TypeDescription
captionstringRepresents the field label
tagstringRepresents the unique identifier of the field to retrieve or set its value
defaultvalueobjectThe default value to be set during the creation of the field
Examples
dataform.addfieldtext("Customer name","name","Bob")

closewithx

DescriptionIndicates if the dataform has been closed with the x
Value Typeboolean
Formatboolean = dataform.closewithx
TypeProperty
SystemsWindows, Web, Android, IOS, Mac OS

getvalue

DescriptionRetrieves a value
Value Typeobject
Formatobject = dataform.getvalue(tag)
TypeMethod
SystemsWindows, Web, Android, IOS, Mac OS
ParameterValue TypeDescription
tagstringRepresents the unique identifier of the field from which the value will be retrieved
Examples
value = dataform.getvalue("name")

setheight

DescriptionSets the height of the dataform in pixels
Value Type
Formatdataform.setheight(height)
TypeMethod
SystemsWindows, Web, Android, IOS, Mac OS
ParameterValue TypeDescription
heightintegerRepresents the value of the dataform height
Examples
dataform.setheight(300)

settitle

DescriptionSets the title of the dataform
Value Type
Formatdataform.settitle(title)
TypeMethod
SystemsWindows, Web, Android, IOS, Mac OS
ParameterValue TypeDescription
titlestringThe title of the dataform
Examples
dataform.settitle("Select date")

setvalue

DescriptionSets the value of a field in the dataform
Value Type
Formatdataform.setvalue(tag, value)
TypeMethod
SystemsWindows, Web, Android, IOS, Mac OS
ParameterValue TypeDescription
tagstringRepresents the unique identifier of the field on which the value will be set
valueobjectThe value that will be set in the field

show

DescriptionShows the dataform
Value Type
Formatdataform.show()
TypeMethod
SystemsWindows, Web, Android, IOS, Mac OS