Click or drag to resize
RunLoadTargetRecords Method
Loads the target records.

Namespace:  Biolomics.BioCallback
Assembly:  Biolomics.BioCallback (in Biolomics.BioCallback.dll) Version: 1.0.0.0 (1.0.0.0)
Syntax
public static void LoadTargetRecords(
	XRecordMap p_RecordMap,
	int p_ReadTimeout,
	int p_MaxTarget
)

Parameters

p_RecordMap
Type: Biolomics.BioCallbackXRecordMap
The record map.
p_ReadTimeout
Type: SystemInt32
The read timeout to be set for the query.
p_MaxTarget
Type: SystemInt32
The maximum target record loaded.
Examples
This exemple demonstrates how to load target records and show some informations.
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