XFileLinkField Class |
Code of field: FLink (for File Link)
Type of field: Link to F field that is a container for files of any format (pictures, MS-Office documents, trace files, etc).
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 XFileLinkField type exposes the following members.
Name | Description | |
---|---|---|
XFileLinkField(XFileLinkField) |
Copy ctor
| |
XFileLinkField(TFileLinkField, XRecord) |
Initializes a new instance of the XFileLinkField class.
| |
XFileLinkField(XFileLinkField, XRecord) |
Copy ctor but into a new XRecord
|
Name | Description | |
---|---|---|
FieldValue |
Gets or sets the field value.
(Overrides XFieldFieldValue.) | |
IsModified |
Gets or sets a value indicating whether this instance is modified.
(Inherited from XField.) |
Name | Description | |
---|---|---|
AddLink |
Adds existing target record.
(Inherited from XLinkField.) | |
CanRead |
Determines whether current connection can read from Field.
(Inherited from XField.) | |
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).) | |
Count |
Counts the link field items.
(Inherited from XLinkField.) | |
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
(Inherited from XLinkField.) | |
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.) | |
LinkField |
Gets the Link field.
(Overrides XLinkFieldLinkField.) | |
LoadTargetRecords |
Loads the target records.
(Inherited from XLinkField.) | |
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.) | |
Records |
Gets the records properties as a recordmap.
(Inherited from XLinkField.) | |
Reset |
Resets this instance.
(Inherited from XField.) | |
SetDefaultValues |
Sets the default values.
(Inherited from XField.) | |
TargetSqlCo |
Gets the target connection.
(Inherited from XLinkField.) | |
ToString | Returns a string that represents the current object. (Inherited from Object.) | |
Values |
Gets the values of the Linked items.
(Inherited from XLinkField.) | |
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
Imports System Imports BioloMICS.BioCallback Imports BioloMICS.SharedClasses Imports Biolomics.Utility.DatabaseConstants Public Class Program <STAThread()> Shared Sub Main() Dim c As New Program c.CheckRecords() End Sub Public Sub CheckRecords() 'get the current connection Dim SqlCo As XConnection = Run.GetCurrentConnection() If SqlCo Is Nothing Then Return End If 'get the selected table Dim CurrentLayout As XDataLayout = Run.GetCurrentLayout() Dim TableDef As XTableDef = SqlCo.GetTableDef(CurrentLayout.TableKey) If TableDef Is Nothing Then ' may happen if that table doesn't exist Return End If 'fill in a list of all fields to load from the collection table Dim FieldDefMap As New XFieldDefMap Dim SourceOfField As XFieldDef = SqlCo.GetFieldByUserNameEng("country", TableDef.key) 'Dim SourceField As XFieldDef = Sqlco.GetFieldByDbName("rlink2981", TableDef.key) 'Add fields to the map to be loaded FieldDefMap.Add(SourceOfField) 'Search for the user and get it's data Dim WhereStock As XWhere 'load record 8 WhereStock = XWhere.Eq(staticfields.id, 9) Dim RecordMapStock As XRecordMap = Run.LoadRecords(TableDef.Key, FieldDefMap, WhereStock) Run.LoadTargetRecords(RecordMapStock, 400, 7) Console.WriteLine(RecordMapStock.Count.ToString) Dim i As Integer = 0 Dim j As Integer = 0 'loop on the selected records For Each OriginalRecord As XRecord In RecordMapStock 'OriginalRecord.Name <> field 'Change the consortium name' Dim LinkedName As XRecLinkField = CType(OriginalRecord.Fields(SourceOfField.Key), XRecLinkField) Dim stockRecordMap As XRecordMap = LinkedName.Records If stockRecordMap.Count > 0 Then For Each StockRecord As XRecord In stockRecordMap 'loop and write target record name Console.WriteLine(StockRecord.Name) Next End If Next End Sub End Class