Click or drag to resize
XNLinkField Class
Class XNLinkField.

 

Code of field: NLink (for DNA Link)

Type of field: Link to N field that is a container for sequence data (DNA or protein).

Applicable to:

List of one or several DNA or protein sequences.

Inheritance Hierarchy

Namespace:  Biolomics.BioCallback
Assembly:  Biolomics.BioCallback (in Biolomics.BioCallback.dll) Version: 1.0.0.0 (1.0.0.0)
Syntax
public class XNLinkField : XLinkField

The XNLinkField type exposes the following members.

Constructors
  NameDescription
Public methodXNLinkField(XNLinkField)
Copy ctor
Public methodXNLinkField(TNLinkField, XRecord)
Initializes a new instance of the XNLinkField class.
Public methodXNLinkField(XNLinkField, XRecord)
Copy ctor but into a new XRecord
Top
Properties
  NameDescription
Public propertyFieldValue
Gets or sets the field value.
(Overrides XFieldFieldValue.)
Public propertyIsModified
Gets or sets a value indicating whether this instance is modified.
(Inherited from XField.)
Top
Methods
  NameDescription
Public methodAddLink
Adds existing target record.
(Inherited from XLinkField.)
Public methodCanRead
Determines whether current connection can read from Field.
(Inherited from XField.)
Public methodCanWrite
Determines whether current connection can write from Field.
(Inherited from XField.)
Public methodClear
Clears this instance.
(Inherited from XField.)
Public methodClone
Clones this instance.
Public methodCloneAsXField
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).)
Public methodCount
Counts the link field items.
(Inherited from XLinkField.)
Public methodDataToView
Converts field value to readable string.
(Inherited from XField.)
Public methodDataToView(Int32)
Mandatory otherwise DataToView(5) returns letter 5 of string given by DataToView(), instead of the subfield value
(Inherited from XField.)
Public methodEquals
Determines whether the specified Object is equal to this instance.
(Inherited from XField.)
Protected methodField
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.)
Public methodFieldDef
Gets the Field definition.
(Inherited from XField.)
Public methodFieldType
The Field type.
(Inherited from XField.)
Protected methodFinalize
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object.)
Public methodGetHashCode
Serves as the default hash function.
(Inherited from Object.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodKey
Gets Field Key.
(Inherited from XField.)
Public methodLinkField
Gets the Link field.
(Overrides XLinkFieldLinkField.)
Public methodLoadTargetRecords
Loads the target records.
(Inherited from XLinkField.)
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Public methodParentRecord
Gets the parent record.
(Inherited from XField.)
Public methodRead
Reads the Content from source object.
(Inherited from XField.)
Public methodRecords
Gets the records properties as a recordmap.
(Inherited from XLinkField.)
Public methodReset
Resets this instance.
(Inherited from XField.)
Public methodSetDefaultValues
Sets the default values.
(Inherited from XField.)
Public methodTargetSqlCo
Gets the target connection.
(Inherited from XLinkField.)
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Public methodValues
Gets the values of the Linked items.
(Inherited from XLinkField.)
Public methodWrite
Writes data into a TQuery and Format it depending to field type
(Inherited from XField.)
Top
Examples
This is an example of use of LoadTargetRecord to get values from linked field.
Example VB.Net
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
See Also