LUA object: datatable

The object represents a data table. The datatable is a set of datarow objects obtained by running an SQL string on the currently open database.

AvailabilityThe object is returned by a method or a property of another object
Pre-initialized inAll scripts
table = database.getsql("SELECT * FROM customers WHERE nation ='italy'")
nrows = table.countrows()
rows = table.getrows()
for i = 1, nrows do
   customername = rows[i].getvalue("name")
   output.print(customername)
end

adddatarow

DescriptionAdds a new datarow object to the collection of rows present within the table
Value Typedatarow
Formatdatarow = datatable.adddatarow()
TypeMethod
SystemsWindows, Web, Android, IOS, Mac OS
Examples
row = datatable.adddatarow()

countrows

DescriptionReturns the number of datarows present in the table
Value Typesingle
Formatsingle = datatable.countrows()
TypeMethod
SystemsWindows, Web, Android, IOS, Mac OS
Examples
number_row = datatable.countrows()

deletedatarow

DescriptionDeletes a specific datarow from the table
Value Typeboolean
Formatboolean = datatable.deletedatarow(row)
TypeMethod
SystemsWindows, Web, Android, IOS, Mac OS
ParameterValue TypeDescription
rowdatarowThe datarow object to delete
Examples
bool = datatable.deletedatarow(row)

getrows

DescriptionRetrieves the complete list of datarows present in the table
Value Typelist<datarow>
Formatlist<datarow> = datatable.getrows()
TypeMethod
SystemsWindows, Web, Android, IOS, Mac OS
Examples
rows = datatable.getrows()