Class ExtraTable

A class to access extra tables and create, edit and delete entries.

Examples

ExtraTable e = getExtraTable("y_myTable");

e.load(2); // Loads ExtraTable with id = 2
e.setValue("fieldname", "Test");
e.setValue("value", "43");
print(e.getValue("Test"));

Constructors

ExtraTable()

Initializes a new instance of the ExtraTable class.

Declaration

ExtraTable

Examples

ExtraTable e = getExtraTable("y_myTable");

e.load(2); // Loads ExtraTable with ID = 2
e.setValue("fieldname", "Test");
e.setValue("value", "43");
print(e.getValue("Test"));

Methods

delete()

Deletes the loaded object.

Declaration

Void delete()

Returns

Type Description
Void

delete(Bool)

Deletes the loaded object.

Declaration

Void delete(Bool signalWebhook)

Parameters

Type Name Description
Bool field True signals that the webhook system should be notified about the deletion.

Returns

Type Description
Void

getValue(String)

Returns the value of the given field for the currently loaded entry.

Declaration

String getValue(String field)

Examples

ExtraTable ex = getExtraTable("y_myTable");

Bool b = ex.load(2);
print(b.toString());

print(ex.getValue("x_table"));

Parameters

Type Name Description
String field The name of the extra table field, for example, x_myfield.

Returns

Type Description
String The value of the given field for the currently loaded entry.

getValues()

Returns all the fields and values of the extraTable row as a Map.

Declaration

Map getValues()

Returns

Type Description
Map All the fields and values of the extraTable row.

load(Integer)

Loads the extra table entry with the given ID.

Declaration

Bool load(Integer id)

Examples

ExtraTable ex = getExtraTable("y_myTable");

Bool b = ex.load(2);
print(b.toString());

Parameters

Type Name Description
Integer id Table ID.

Returns

Type Description
Bool True if the entry was found and loaded; otherwise, false.

loadFromAgentAndKey(Integer,String)

Used for integrating data from external systems.

Declaration

Bool loadFromAgentAndKey(Integer agent, String key)

Parameters

Type Name Description
Integer agent ID of the agent, registered in the Settings/DBI section of Service.
String key ID of this entry in the external system.

Returns

Type Description
Bool True if the entry was found and loaded; otherwise, false.

save()

Creates a new or updates an existing extra-table entry. If ID is set, the table will be updated. Otherwise, a new extra-table entry will be created.

Declaration

Integer save()

Returns

Type Description
Integer The ID of the newly saved object.

save(Bool)

Creates a new or updates an existing extra-table entry. If ID is set, the table will be updated. Otherwise, a new extra-table entry will be created.

Declaration

Integer save(Bool reload)

Parameters

Type Name Description
Bool reload True signals that the entry should be reloaded after the save.

Returns

Type Description
Integer The ID of the newly saved object.

save(Bool,Bool)

Creates a new or updates an existing extra-table entry. If ID is set, the table will be updated. Otherwise, a new extra-table entry will be created.

Declaration

Integer save(Bool reload, Bool signalWebhook)

Parameters

Type Name Description
Bool reload True signals that the entry should be reloaded after the save.
Bool signalWebhook True signals that the webhook system should be notified about the save.

Returns

Type Description
Integer The ID of the newly saved object.

setValue(String,String)

Sets the value of a given field if it exists.

Declaration

Void setValue(String field, String value)

Examples

ExtraTable ex = getExtraTable("y_myTable");

Bool b = ex.load(2);
print(b.toString());

ex.setValue("name", "Test");
print(ex.getValue("x_table"));

Parameters

Type Name Description
String field Name of field to set.
String value A string representation of the value to be assigned to the field.

Returns

Type Description
Void