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. declare record RecPerson
  2.   field string firstName
  3.   field string lastName
  4.   field integer yearBorn
  5.   field string hobbies variable
  6.  
  7. process
  8.   local RecPerson persons variable
  9.  
  10.   ;create a person
  11.   new persons{'208'}
  12.   set persons:firstName to 'Michael'
  13.   set persons:lastName to 'Woods'
  14.   set persons:yearBorn to 1970
  15.   set new persons:hobbies to 'reading'
  16.   set new persons:hobbies to 'drumming'
  17.   set new persons:hobbies to 'listen to music'
  18.  
  19.   ;create an other person
  20.   new persons{'209'}
  21.   set persons:firstName to 'Jane'
  22.   set persons:lastName to 'Turner'
  23.   set persons:yearBorn to 1974
  24.   set new persons:hobbies to 'singing'
  25.   set new persons:hobbies to 'painting'
  26.   set new persons:hobbies to 'reading'
  27.  
  28.   ;looping over the persons
  29.   repeat over persons
  30.     output '[' || key of persons || '] '
  31.     output persons:firstname || ' likes: '
  32.     repeat over persons:hobbies as persHobby
  33.       output persHobby
  34.       output ', ' when not #last
  35.     again
  36.     output '%n'
  37.   again

The output result:

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

Second example: creating records based on XML input

  1. declare record RecPerson
  2.   field string firstName
  3.   field string lastName
  4.   field integer yearBorn
  5.   field string hobbies variable
  6.  
  7. global RecPerson persons variable
  8.  
  9. process
  10.   do xml-parse
  11.     scan
  12.       '<?xml version="1.0" encoding="UTF-8"?>%n' ||
  13.       '<persons>%n' ||
  14.       '  <person num="208" born="1970">%n' ||
  15.       '    <firstn>Michael</firstn>%n' ||
  16.       '    <lastn>Woods</lastn>%n' ||
  17.       '    <hobbies>%n' ||
  18.       '      <hobby>reading</hobby>%n' ||
  19.       '      <hobby>drumming</hobby>%n' ||
  20.       '      <hobby>listen to music</hobby>%n' ||
  21.       '    </hobbies>%n' ||
  22.       '  </person>%n' ||
  23.       '  <person num="209" born="1974">%n' ||
  24.       '    <firstn>Jane</firstn>%n' ||
  25.       '    <lastn>Turner</lastn>%n' ||
  26.       '    <hobbies>%n' ||
  27.       '      <hobby>singing</hobby>%n' ||
  28.       '      <hobby>painting</hobby>%n' ||
  29.       '      <hobby>reading</hobby>%n' ||
  30.       '    </hobbies>%n' ||
  31.       '  </person>%n' ||
  32.       '</persons>'
  33.     suppress
  34.   done
  35.  
  36. process-end
  37.   ;looping over the persons
  38.   repeat over persons
  39.     output '[' || key of persons || '] '
  40.     output persons:firstname || ' likes: '
  41.     repeat over persons:hobbies as persHobby
  42.       output persHobby
  43.       output ', ' when not #last
  44.     again
  45.     output '%n'
  46.   again
  47.  
  48. element #implied
  49.   suppress
  50.  
  51. element person
  52.   new persons{attribute num}
  53.   set persons:yearBorn to attribute born
  54.   suppress
  55.  
  56. element firstn
  57.   set persons:firstName to '%c'
  58.  
  59. element lastn
  60.   set persons:lastName to '%c'
  61.  
  62. element hobby
  63.   set new persons:hobbies to '%c'

This results in the same output:

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