Class ExtraFieldsInfo
With this class, you can retrieve meta-information about an extra field.
The class will only retrieve information, thus it is not possible to change an extra field from this class.Syntax
Examples
ExtraFieldsInfo e;
e.getExtraFields("person"); // Finds extraFields in table person
Constructors
ExtraFieldsInfo()
Initializes a new instance of the ExtraFieldsInfo class.
Declaration
ExtraFieldsInfo
Examples
ExtraFieldsInfo e;
e.getExtraFields("person"); // Finds extraFields in table person
Methods
eof()
Checks if there are no more fields in the result.
Declaration
Bool eof()
Returns
Type | Description |
---|---|
Examples
ExtraFieldsInfo efi;
for (efi.getTicketChildrenFields(); !efi.eof(); efi.next())
{
// do something with information from efi
}
getChildrenFields(Integer,Integer)
Loads extra fields of the type given in the first parameter. If the type is an extra table relation, the second pointer is the ID of the extra table it points to.
Declaration
Void getChildrenFields(Integer type, Integer extraTableTarget)
Parameters
Type | Name | Description |
---|---|---|
Integer | type | |
Integer | extraTableTarget |
Returns
Type | Description |
---|---|
Void |
Remarks
Unless type is 20 (extratable), the second parameter won't do anything.
Types can be:Integer = 1, Text (long) = 2, Date = 3, DateTime = 4, Time = 5, Bool = 6, TimeSpan = 7, Text (short) = 10, Customer relation = 16, Company relation = 17, Ticket relation = 18, User relation = 19, Extra table relation = 20, Attachment relation = 22, Link = 23, Category relation = 24, Priority relation = 25, FAQ relation = 26Examples
If you want all extra fields pointing to the extra table with ID 5, you'd call getChildrenFields(20, 5)
If you want all extra fields of type Dat you'd call getChildrenFields(3, 0)getCompanyChildrenFields()
This is a helper function for getting company relation fields. It is equivalent to calling getChildrenFields(17, 0).
Declaration
getCompanyChildrenFields()
Returns
Type | Description |
---|---|
Void |
Examples
ExtraFieldsInfo e;
e.getExtraFields("person"); // Finds extraFields in table person
getCustomerChildrenFields()
This is a helper function for getting customer relation fields. It is equivalent to calling getChildrenFields(16, 0).
Declaration
Void getCustomerChildrenFields()
Returns
Type | Description |
---|---|
Void |
Examples
ExtraFieldsInfo e;
e.getExtraFields("person"); // Finds extraFields in table person
getDisplayField()
Returns the display field of the current field.
Declaration
String getDisplayField()
Returns
Type | Description |
---|---|
String |
Remarks
The display field is a format of the field that can be used to address the field in functions such as SearchEngine.
Examples
ExtraFieldsInfo e;
e.getExtraFields("person");
print(e.getDisplayField());
getExtraFields(String)
Gets extra fields related to the given table. Using this method will make it possible to access the information in the extra fields by using the other functions in the class.
Declaration
Void getExtraFields(String table)
Parameters
Type | Name | Description |
---|---|---|
String | table |
Returns
Type | Description |
---|---|
Void |
Examples
ExtraFieldsInfo e;
e.getExtraFields("person");
getFieldName()
Returns the field name of the current field.
Declaration
String getFieldName()
Returns
Type | Description |
---|---|
String | The field name of the current field. |
Examples
This code prints all field names of extra fields:
ExtraFieldsInfo e;
e.getExtraFields("person");
while(!e.eof()){
print(e.getFieldName());
e.next();
}
getFlags()
Returns the flags for the current extra field.
The flags can be accessed by wrapping the returned Integer in a FHBitSet.Declaration
Integer getFlags()
Returns
Type | Description |
---|---|
Integer |
Remarks
Flag | Description |
---|---|
0 | The field is searchable |
1 | The field is public (external) |
2 | The field is viewed in new-ticket form |
3 | The field is set (datetime) when clicked |
4 | The field cannot change after being set |
5 | The field is a dropdown (extra string fields) |
6 | The field is directly readable from database |
7 | Do not HTML-escape the value when displaying field |
8 | The field is deleted |
9 | The field is the ID |
10 | The field is a foreign ID |
11 | The field is not writeable |
12 | Use default value for field if no value is supplied |
13 | List relations |
14 | View this field when listing rows |
15 | Hide the header for this list if there are no entries |
16 | Hide the function buttons for this relation |
17 | The field cannot be empty |
18 | The field is not shown anywhere |
19 | The field is indexed |
20 | The field is viewed in relational searches |
21 | The field listed with the other main properties for the entity (i.e. for 'Edit ticket' it is shown on the first pane) |
22 | The field is a FK, and in Archives this relation should be followed and columns in the target table should be available in the archive |
Examples
FHBitSet flags;
flags.set(extraField.getFlags());
flags.getBitNo(17); // returns true if the extra field cannot be empty
getName()
Returns the descriptive name (not the database name) of the current field.
Declaration
String getName()
Returns
Type | Description |
---|---|
String |
Examples
This code prints all names of extra fields:
ExtraFieldsInfo e;
e.getExtraFields("person");
while(!e.eof()) {
print(e.getName());
e.next();
}
getParam(String,String)
This function returns the value of the given parameter.
Declaration
String getParam(String parameter)
Parameters
Type | Name | Description |
---|---|---|
String | parameter | The info to get, see list of values. |
Returns
Type | Description |
---|---|
String |
Remarks
Available values:
Variable | Available to | Description |
---|---|---|
defaultNow | all types | use current time and date as default value |
defaultActiveUser | all types | use active user as default value |
fields | TimeSpan | number of fields |
height | Text long | |
linkName | Dynamic link | |
linkValue | Dynamic link | url |
onlyLeafNode | Extra table relation | |
precision | Float | number of decimals |
option | Text long, Text short | |
useDays | TimeSpan | |
useHours | TimeSpan | |
useMinutes | TimeSpan | |
useTextArea | Text long | |
targetLabel | Contact relation, Company relation, Request relation, Extra table relation | header |
Examples
ExtraFieldsInfo e;
e.getExtraFields("person"); // Finds extraFields in table person
getTableName()
Returns the name of the table the current field belongs to.
Declaration
String getTableName()
Returns
Type | Description |
---|---|
String | The table the current field belongs to. |
Examples
ExtraFieldsInfo e;
e.getExtraFields("person");
print(e.TableName());
Will print "person".
getTicketChildrenFields()
This is a helper function for getting ticket relation fields. It is equivalent to calling getChildrenFields(18, 0).
Declaration
Void getTicketChildrenFields()
Returns
Type | Description |
---|---|
Void |
Examples
ExtraFieldsInfo e;
e.getExtraFields("person"); // Finds extraFields in table person
next()
This function moves to the next field in the result.
Declaration
Void next()
Returns
Type | Description |
---|---|
Void |
Remarks
A common usage is in the increment section in a for loop.
Examples
ExtraFieldsInfo efi;
for (efi.getTicketChildrenFields(); !efi.eof(); efi.next())
{
// do something with information from efi
}