Database

The object database has all the main functions and methods for interacting directly with the currently open database.

value* = database.name()

Returns the name of the database.

database.createtable(*tablename*)

Creates a new table within the database by restoring a boolean value if the operation was successful or not.

database.createfield(*tablename*,*fieldname*,*fieldlabel*,*fieldtype*,*widthtype*,*panelname*,*editable*,*displayable*)

Creates a new field within a table. The following parameters are for the creation of a standars field and based on the type of field, the parameters dedicated to its type must then be created.

tablename

The name of the table where the field will be created.

fieldname

The very name of the field.

fieldlabel

The label that will be displayed on the field.

fieldtype

The field type to create Text = 0 Notes = 1 Image = 2 Percentage = 3 Check = 4 Currency = 5 Color = 6 Date = 18 IntegerNumber = 9 DecimalNumber = 10 Separator = 11 List = 12 Email = 14 GlobalCounter = 15 SubTable= 20 DocumentState = 21 Tree = 22 GeographicLocation = 24 Link = 25 Telephono = 26 StateList = 27 File = 28 ValueAllocator = 29 Signature = 30

widhtype

The width factor that the field will have on the form Total = 1 Half = 2 Quarter = 3

panelname

The name of the panel where the field will be displayed inside the form.

editable

The bitwise of the user category to allow for its modification (1 = admin).

displayable

The bitwise of the user category to allow its display (1 = admin).

*value* = database.fieldexist(*tablename*,*fieldname*)

Checks if there is a field within a table in the current database.

*value* = database.tableexist(*tablename*)

Checks if there is a table within the current database.

database.accessorytable(*tablename*,true)

Adds or removes an accessory table.

database.deletedatarowsql(*sql*)

Deletes a list of data from the database based on an SQL string.

database.deletedatarow(*datarow*)

Deletes a datarow from the database.

*datatable* = database.getsql(*sql*)

Returns a datatable data table.

database.setsql(*sql*)

Executes an SQL string on the current database.

*datafield* = database.newdatafield()

Creates a new dummy field. The field is not saved within the database.

*datarow* = database.newdatarow(*tablename*)

Creates a new row from a table. The row is not present in the database until it is saved.

database.viewcolumn(*tablename*,*fieldname*,true)

Determines whether the column of a field is displayed or not within the editing / visualization table.

Put True to display it or False to hide it.

database.addsyncbox(*tablename*,*gguid*)

Adds a row to the mobile syncbox. While the Windows client automatically manages what to synchronize for mobile clients, it is necessary to instruct the system to send the row of data in synchronization if the database is a cloud.

*value* = database.getind(*tablename*)

Retrieves the last value of the ind column within the requested table.

*boolean* = database.dbnull(value)

Returns whether a value is null or not.

database.subtable_tablename(*tablename*,*fieldname*,*totablename*)

Sets the table used by the Subtable field.

database.subtable_addpairing(*tablename*,*fieldname*,*fromvalue*,*tovalue*)

Adds a match to the Subtable field.

database.list_addvalue(*listname*,*value*)

Adds an item to a list.

database.date_format(*tablename*,*fieldname*,*format*)

Sets the type of formatting to use for a date type field.

database.createdocument(*gguidprint*,*tablename*,*gguidrif*)

Creates a document object starting from a print gguid, the table name is the row gguid belonging to the passed table.