OmniMark records is a nice feature to hold some data of a certain type together.
Suppose we have a type person with firstname, lastname, birth and hobbies.

First example: creating records and loop over them

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
declare record RecPerson
  field string firstName
  field string lastName
  field integer yearBorn
  field string hobbies variable

process
  local RecPerson persons variable

  ;create a person
  new persons{'208'}
  set persons:firstName to 'Michael'
  set persons:lastName to 'Woods'
  set persons:yearBorn to 1970
  set new persons:hobbies to 'reading'
  set new persons:hobbies to 'drumming'
  set new persons:hobbies to 'listen to music'

  ;create an other person
  new persons{'209'}
  set persons:firstName to 'Jane'
  set persons:lastName to 'Turner'
  set persons:yearBorn to 1974
  set new persons:hobbies to 'singing'
  set new persons:hobbies to 'painting'
  set new persons:hobbies to 'reading'

  ;looping over the persons
  repeat over persons
    output '[' || key of persons || '] '
    output persons:firstname || ' likes: '
    repeat over persons:hobbies as persHobby
      output persHobby
      output ', ' when not #last
    again
    output '%n'
  again

The output result:

output result
[208] Michael likes: reading, drumming, listen to music
[209] Jane likes: singing, painting, reading

Second example: creating records based on XML input

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
declare record RecPerson
  field string firstName
  field string lastName
  field integer yearBorn
  field string hobbies variable

global RecPerson persons variable

process
  do xml-parse
    scan
      '<?xml version="1.0" encoding="UTF-8"?>%n' ||
      '<persons>%n' ||
      '  <person num="208" born="1970">%n' ||
      '    <firstn>Michael</firstn>%n' ||
      '    <lastn>Woods</lastn>%n' ||
      '    <hobbies>%n' ||
      '      <hobby>reading</hobby>%n' ||
      '      <hobby>drumming</hobby>%n' ||
      '      <hobby>listen to music</hobby>%n' ||
      '    </hobbies>%n' ||
      '  </person>%n' ||
      '  <person num="209" born="1974">%n' ||
      '    <firstn>Jane</firstn>%n' ||
      '    <lastn>Turner</lastn>%n' ||
      '    <hobbies>%n' ||
      '      <hobby>singing</hobby>%n' ||
      '      <hobby>painting</hobby>%n' ||
      '      <hobby>reading</hobby>%n' ||
      '    </hobbies>%n' ||
      '  </person>%n' ||
      '</persons>'
    suppress
  done

process-end
  ;looping over the persons
  repeat over persons
    output '[' || key of persons || '] '
    output persons:firstname || ' likes: '
    repeat over persons:hobbies as persHobby
      output persHobby
      output ', ' when not #last
    again
    output '%n'
  again

element #implied
  suppress
 
element person
  new persons{attribute num}
  set persons:yearBorn to attribute born
  suppress
 
element firstn
  set persons:firstName to '%c'

element lastn
  set persons:lastName to '%c'
 
element hobby
  set new persons:hobbies to '%c'

This results in the same output:

output result
[208] Michael likes: reading, drumming, listen to music
[209] Jane likes: singing, painting, reading
Rating 3.00 out of 5
[?]