Class ExtraTable
A class to access extra tables and create, edit and delete entries.
Syntax
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 |
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"));
getValue(String)
Returns the value of the given field for the currently loaded entry.
Declaration
String getValue(String field)
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. |
Examples
ExtraTable ex = getExtraTable("y_myTable");
Bool b = ex.load(2);
print(b.toString());
print(ex.getValue("x_table"));
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. |
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"));
load(Integer)
Loads the extra table entry with the given ID.
Declaration
Bool load(Integer id)
Parameters
Type | Name | Description |
---|---|---|
Integer | id | Table ID. |
Returns
Type | Description |
---|---|
Bool | True if the entry was found and loaded; otherwise, false. |
Examples
ExtraTable ex = getExtraTable("y_myTable");
Bool b = ex.load(2);
print(b.toString());
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. |
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"));
save()
Creates a new or updates an existing extra-tableSaves an extra table. 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. |
Remarks
Use save(Bool) to signal that the entry should be reloaded after the save.
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"));
save(Bool)
Creates a new or updates an existing extra-tableSaves an extra table. 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. |
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"));
setValue(String,String)
Sets the value of a given field if it exists.
Declaration
Void setValue(String field, String value)
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 |
Examples
ExtraTable ex = getExtraTable("y_myTable");
Bool b = ex.load(2);
print(b.toString());
ex.setValue("name", "Test");
print(ex.getValue("x_table"));