Click or drag to resize
XFieldMap Class
Class XFieldMap.
Inheritance Hierarchy
SystemObject
  System.Collections.ObjectModelCollectionXField
    System.Collections.ObjectModelKeyedCollectionInt64, XField
      Biolomics.BioCallbackXFieldMap

Namespace:  Biolomics.BioCallback
Assembly:  Biolomics.BioCallback (in Biolomics.BioCallback.dll) Version: 1.0.0.0 (1.0.0.0)
Syntax
public class XFieldMap : KeyedCollection<long, XField>

The XFieldMap type exposes the following members.

Constructors
  NameDescription
Public methodXFieldMap
Initializes a new instance of the XFieldMap class.
Top
Properties
  NameDescription
Public propertyComparer
Gets the generic equality comparer that is used to determine equality of keys in the collection.
(Inherited from KeyedCollectionInt64, XField.)
Public propertyCount (Inherited from CollectionXField.)
Protected propertyDictionary (Inherited from KeyedCollectionInt64, XField.)
Public propertyItemTKey
Gets the element with the specified key.
(Inherited from KeyedCollectionInt64, XField.)
Public propertyItemInt32
Gets or sets the element at the specified index.
(Inherited from CollectionXField.)
Protected propertyItems (Inherited from CollectionXField.)
Top
Methods
  NameDescription
Public methodAdd (Inherited from CollectionXField.)
Protected methodChangeItemKey
Changes the key associated with the specified element in the lookup dictionary.
(Inherited from KeyedCollectionInt64, XField.)
Public methodClear (Inherited from CollectionXField.)
Protected methodClearItems (Inherited from KeyedCollectionInt64, XField.)
Public methodClone
Clones the specified parent record.
Public methodContains(TKey)
Determines whether the collection contains an element with the specified key.
(Inherited from KeyedCollectionInt64, XField.)
Public methodContains(T) (Inherited from CollectionXField.)
Public methodCopyTo (Inherited from CollectionXField.)
Public methodEquals
Determines whether the specified object is equal to the current object.
(Inherited from Object.)
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 methodGetEnumerator (Inherited from CollectionXField.)
Public methodGetHashCode
Serves as the default hash function.
(Inherited from Object.)
Public methodGetItemByIdx
Gets the item.
Protected methodGetKeyForItem
Gets the key for item.
(Overrides KeyedCollectionTKey, TItemGetKeyForItem(TItem).)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodIndexOf (Inherited from CollectionXField.)
Public methodInsert (Inherited from CollectionXField.)
Protected methodInsertItem (Inherited from KeyedCollectionInt64, XField.)
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Public methodRemove(Int64)
Removes the specified key.
Public methodRemove(T) (Inherited from CollectionXField.)
Public methodRemoveAt (Inherited from CollectionXField.)
Protected methodRemoveItem (Inherited from KeyedCollectionInt64, XField.)
Protected methodSetItem
Replaces the item at the specified index with the specified item.
(Inherited from KeyedCollectionInt64, XField.)
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Top
Operators
  NameDescription
Public operatorStatic memberEquality
Implements the operator =.
Public operatorStatic memberInequality
Implements the operator <>.
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

Reference

[!:System.Collections.ObjectModel.KeyedCollection{System.Int64, Biolomics.BioCallback.XField}]