| Syntax Color Legend |
|---|
| Command |
| Mandatory parameter |
| Optional parameter |
| Mandatory keyword |
| Optional keyword |
ATTACHTOBOX (<Fieldname>, <Filename>)
Use the ATTACHTOBOX command to assign the content of an existing contents file (with any filename) to a listbox or combobox on a form. This is supported only when the Memory Based property for that control is set to false in the Object Inspector.
None
| Parameter | Description |
|---|---|
| <Fieldname> |
The name and location of a layout control element. The syntax for a field name is as follows:
To avoid overlap when opening listbox or combobox elements, choose a suitable vertical offset setting. <Formname> is the name of the form. Instead of a specific form name, the asterisk (*) can be
specified to assign all forms. |
| <Filename> | Expression that gives the name of the text file (considered a single string) from which data is read. It is also possible to use a file ID as filename if the file ID has a physical file location set. The file will then be copied to the default listbox folder as set in the base path. |
The file is read, and the listbox or combobox is filled with the content of that file. Within the file, delimiters define which value must be placed where. This file should be located in the listbox folder as set in the basepath.
The ATTACHTOBOX command can be used to fill the listbox or combobox with a file that applies only to the currently logged-on user. A different file can be used for each user, depending on user rights. Files can be updated during the night. This way, users always have the most recent information at hand.
If you prefer to let AMT handle the files, and you don't want to point to a specific file, you can use the FILLBOX command. However, the ATTACHTOBOX command always provides better performance.
The file "FieldContent.txt" has the following content:
| ordjan | Orders January
| offjan | Offers January
| ordfeb | Orders February
| offfeb | Offers February// When in the code
attachtobox ('*.lbxselproduct', 'FieldContent.txt')
// All the layout controls that are called "lbxselproduct"
// are filled with the content of the file "FieldContent"