RunLoadRecords Method (Int64, XFieldDefMap, XWhere, XOrderBy, Int32) |
Namespace: Biolomics.BioCallback
public static XRecordMap LoadRecords( long p_TableKey, XFieldDefMap p_FieldDefMap, XWhere p_Where, XOrderBy p_OrderBy = null, int p_Limit = 0 )
Imports System Imports BioloMICS.BioCallback Imports BioloMICS.SharedClasses Public Class Program <STAThread()> Shared Sub Main() Dim c As New Program c.ChangeRecordDetails() End Sub ' Write sub functions here Public Sub ChangeRecordDetails() ' 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 ' load all records Dim Where As XWhere = XWhere.All ' use an empty FieldDefMap Dim FieldDefMap As New XFieldDefMap ' load the records Dim RecordMap As XRecordMap = Run.LoadRecords(TableDef.Key, FieldDefMap, Where) For Each Record As XRecord In RecordMap ' change the record details, located in the record header Record.Details = "This is record #" & Record.Id.ToString Record.Save(False) Next ' load the records second methode Dim newRecordMap As New XRecordMap Run.LoadRecords(newRecordMap, TableDef.Key, FieldDefMap, Where) For Each Record As XRecord In newRecordMap ' change the record details, located in the record header empty string instead of old value Record.Details = String.Empty Record.Save(False) Next End Sub End Class