XFileField Class |
Code of field: F (for File)
Type of field: container for files of any format (pictures, MS-Office documents, trace files, etc).
Storage: The file content is stored in a BLOB (Binary Large Object) in the database.
Applicable to:
Any file of any format associated with a given record. Files that are too large could create problems depending on the setting of the underlying database (MySQL, MongoDB) since some size limitations may apply.
Namespace: Biolomics.BioCallback
The XFileField type exposes the following members.
Name | Description | |
---|---|---|
XFileField(XFileField) |
Copy ctor
| |
XFileField(TFileField, XRecord) |
Initializes a new instance of the XFileField class.
| |
XFileField(XFileField, XRecord) |
Copy ctor but into a new XRecord
|
Name | Description | |
---|---|---|
Content |
Gets or sets the content of the file.
| |
FieldValue |
Gets or sets the field value.
(Overrides XFieldFieldValue.) | |
FileName |
Gets or sets the name of the file.
| |
IsModified |
Gets or sets a value indicating whether this instance is modified.
(Inherited from XField.) |
Name | Description | |
---|---|---|
CanRead |
Determines whether current connection can read from Field.
(Inherited from XField.) | |
CanUploadFile |
Determines whether this instance [can upload file] the specified main SQL co.
| |
CanWrite |
Determines whether current connection can write from Field.
(Inherited from XField.) | |
Clear |
Clears this instance.
(Inherited from XField.) | |
Clone |
Clones this instance.
| |
CloneAsXField |
We cannot use name 'Clone' here otherwise Implements vector.TId(Of XSField) fails because XSField.Clone() returns a XField instead of a XSField !!!
(Overrides XFieldCloneAsXField(XRecord).) | |
DataToView |
Converts field value to readable string.
(Inherited from XField.) | |
DataToView(Int32) |
Mandatory otherwise DataToView(5) returns letter 5 of string given by DataToView(), instead of the subfield value
(Inherited from XField.) | |
Equals |
Determines whether the specified Object is equal to this instance.
(Inherited from XField.) | |
Field |
each derived class embed its own TField member, which can be a TAField, TCField, TEField, etc.
this function must return that original TField
(Overrides XFieldField.) | |
FieldDef |
Gets the Field definition.
(Inherited from XField.) | |
FieldType |
The Field type.
(Inherited from XField.) | |
Finalize | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.) | |
GetHashCode | Serves as the default hash function. (Inherited from Object.) | |
GetType | Gets the Type of the current instance. (Inherited from Object.) | |
Key |
Gets Field Key.
(Inherited from XField.) | |
LoadLocalFile |
Loads the local file.
| |
MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) | |
ParentRecord |
Gets the parent record.
(Inherited from XField.) | |
Read |
Reads the Content from source object.
(Inherited from XField.) | |
Reset |
Resets this instance.
(Inherited from XField.) | |
SaveLocalFile |
Saves the local file.
| |
SetDefaultValues |
Sets the default values.
(Inherited from XField.) | |
ToString | Returns a string that represents the current object. (Inherited from Object.) | |
Write |
Writes data into a TQuery
and Format it depending to field type
(Inherited from XField.) |
Imports System Imports System.Collections Imports Biolomics.BioCallback Imports Biolomics.SharedClasses Imports Biolomics.Utility.DatabaseConstants Public Class Program <STAThread()> Shared Sub Main() Dim program As New Program program.UploadFile() program.CheckRecords() End Sub Public Sub UploadFile() ' ***** Get selected record IDs ***** Dim RecordIdList As New Generic.List(Of Integer) Dim ErrorCode As Integer = Run.GetSelRecordIdList(RecordIdList, Run.GetRecordIdListEnum.Selected) If RecordIdList.Count = 0 Then Return End If ' get the current connection Dim SqlCo As XConnection = Run.GetCurrentConnection() If SqlCo Is Nothing Then Return End If ' get the current layout table Dim CurrentLayout As XDataLayout = Run.GetCurrentLayout() If CurrentLayout Is Nothing Then Return End If ' get the current table displayed in that layout Dim TableDef As XTableDef = SqlCo.GetTableDef(CurrentLayout.TableKey) If TableDef Is Nothing Then Return End If Dim FullFileName As String = "Your_Full_Fil_Name\result.png" Dim FileLinkName As String = "Your_FileLink_Field_Name" ' attach to the first selected record Dim RecordId As Integer = RecordIdList(0) ErrorCode = Run.UploadFile(FullFileName, TableDef.UserName, FileLinkName, RecordId) If ErrorCode <> 0 Then Console.Write(vbCrLf & "Could not upload file") End If End Sub End Class