### Map Fields

Assigning the content of database fields to controls, like a TextField or TextArea, can be done
by making use of a Map.
These are example subs for a table with two text fields (Subject and Description) which content
is assigned to controls:
For field Subject (Type Text): Private txtSubject As TextField
For field Description (Type Text): Private txtDescription As TextArea
FieldToMap
'Assign the content of a field to a map
`Sub FieldsToMap As Map
Dim mf As Map
mf.Initialize
'mf.Put("id", lblID.Text) - Primary Key not mapped
mf.Put("subject", txtSubject.Text)
mf.Put("description", txtDescription.Text)
Return mf
End Sub`
MapToFields
'Assign the content of a map to respective fields.
'NOTE: Ensure to use lowercase for the map get subroutine else error!
`Sub MapToFields(mf As Map)
txtSubject.Text = mf.Get("subject")
txtDescription.Text = mf.Get("description")
End Sub`
Notes
If the content of the map is to be verified, use
Log("Show Map")
For i = 0 To mf.Size -1
Log("> " & mf.GetKeyAt(i) & "=" & mf.GetValueAt(i))
Next

Changed: , Category: Database, File: T6C181M1308.htm, ID: 1308