Click or drag to resize
RunLoadRecord Method
Loads the record.

Namespace:  Biolomics.BioCallback
Assembly:  Biolomics.BioCallback (in Biolomics.BioCallback.dll) Version: 1.0.0.0 (1.0.0.0)
Syntax
public static XRecord LoadRecord(
	long p_TableKey,
	int p_RecordId,
	XFieldDefMap p_FieldDefMap
)

Parameters

p_TableKey
Type: SystemInt64
The table key.
p_RecordId
Type: SystemInt32
The record id to load.
p_FieldDefMap
Type: Biolomics.BioCallbackXFieldDefMap
The FieldDefMap used to laod the record info.

Return Value

Type: XRecord
Loaded record
Examples
This is an exemple of loading remarks field information for first record and saving the record after edit
Example VB.Net
Imports System
Imports BioloMICS.BioCallback
Imports BioloMICS.SharedClasses

Public Class Program

    <STAThread()>
    Shared Sub Main()
        Dim program As New Program()
        program.EditRemarks()
    End Sub

    '    Write sub functions here
    Public Sub EditRemarks()
        '    get the current connection
        Dim SqlCo As XConnection = Run.GetCurrentConnection()
        If SqlCo Is Nothing Then
            Return
        End If

        '    get the current layout
        Dim Layout As XDataLayout = Run.GetCurrentLayout()
        If Layout Is Nothing Then  '    no current layout in a search page
            Return
        End If

        '    get the current table
        Dim TableDef As XTableDef = SqlCo.GetTableDef(Layout.TableKey)
        If TableDef Is Nothing Then   '    should never happen
            Return
        End If
        'gets the remarks field definition,it is a XEField
        Dim efield As XFieldDef = SqlCo.GetFieldByUserName("Your_Field_Name", Layout.TableKey)
        'add new XFieldDefMap to be used for loading record informations
        Dim fieldefmap As New XFieldDefMap
        'add remarks field
        If efield IsNot Nothing Then
            fieldefmap.Add(efield)
        Else
            Console.WriteLine("The remarks field is not found please check the field name to be loaded")
            'exits the function
            Exit Sub
        End If

        'load first record and changes the remarks field value
        Dim loadedrecod As XRecord = run.LoadRecord(Layout.TableKey, 1, fieldefmap)
        'check if the loaded record is not nothing to be sure that the records exists
        If loadedrecod IsNot Nothing Then
            'the record exists
            'gets the XEField to get and edit the value
            Dim xefield As XEField = CType(loadedrecod.Fields(efield.Key), xefield)
            If xefield IsNot Nothing Then
                Console.WriteLine("old efield value : " & xefield.Value)
                xefield.Value = "new value " & loadedrecod.Id
                'using saverecord to save the record
                run.SaveRecord(loadedrecod)
            End If
        Else
            Console.WriteLine("The record is not loaded check your database please.")
        End If

    End Sub

End Class
See Also