BioloMICS logo
×
BioloMICS menu

Set the first letter of the record name as uppercase.

 
The code example is very similar to the code above.
 
Imports System
Imports System.Collections
Imports Biolomics.BioCallback
Imports Biolomics.SharedClasses
 
Public Class MyNewClass
 
     ' This function is called when running this script
     Shared Sub Main()
 
          '     Create an instance of class MyNewClass and call its functions
          Dim c As New MyNewClass
          Run.RunTest()
     End Sub
 
     '     Write sub functions here
     Public Sub ChangeName()
          '     get the current connection
          Dim SqlCo As XConnection = Run.GetCurrentConnection()
          If SqlCo Is Nothing Then
               Return
          End If
    
          '     get the current layout/table view
          Dim CurrentLayout As XDataLayout = Run.GetCurrentLayout()
          If CurrentLayout Is Nothing Then
               Return
          End If
    
          '     get the current table displayed in that layout/table view
          Dim TableDef As XTableDef = SqlCo.GetTableDef(CurrentLayout.TableKey)
          If TableDef Is Nothing Then
               Return
          End If
 
          '     load all records
          Dim Where As XWhere = XWhere.All
          Dim RecordMap As XRecordMap = Run.LoadRecords(TableDef.Key, nothing, Where)
 
          '     change record name
          For Each Record As XRecord In RecordMap
               If Record.Name.Length = 0 Then
                    Continue For
               End If
               Record.Name = Char.ToUpper(Record.Name(0)) & Record.Name.Substring(1)
               Record.Save(False)
          Next
     End Sub
 
End Class