===== Commmon Lime Classes =====
* **LDE.Record** -
* **LDE.Filter** -
* **LDE.Field** -
* **LDE.View** -
* **Lime.Inspector** -
* **Lime.Explorer** -
* **Lime.Control** -
{{:customization:vba:limeexample.png?300|}}
{{:customization:vba:inspectorcard.png?300|}}
===== Records =====
A record is a line in the database of a specific class.
'Open a record
Record.Open(Class as class,ID as long,View as view)
'Get options from a field
Database.Classes("business").Fields("businesstatus").Options.Lookup("agreement",lkLookupOptionByKey).Value
===== Batch =====
When creating or updating several records you should use a batch. A batch collects records and make one database call instead of calling the database to update each record.
=== Code example ===
Private Sub UpdatePersons()
On Error GoTo ErrorHandler
Dim oPersonRecord As LDE.Record
Dim oPersonRecords As New LDE.Records
Dim oFilter As New LDE.Filter
Dim oBatch As LDE.Batch
Set oBatch = New LDE.Batch
Set oBatch.Database = Application.Database
Call oFilter.AddCondition("company", lkOpEqual, Application.ActiveInspector.Record.ID)
Call oPersonRecords.Open(Database.Classes("person"), oFilter)
For Each oPersonRecord In oPersonRecords
'Update the values of the person
Call oPersonRecord.Update(oBatch)
If oBatch.Count > 100 Then
Call oBatch.Execute
End If
Next oPersonRecord
If oBatch.Count > 0 Then
Call oBatch.Execute
End If
Exit Sub
ErrorHandler:
Call UI.ShowError("Actionpad_Company.UpdatePersons")
End Sub