UTIL_SortSwitchesByKey

function

Library: Utilities (OMUTIL legacy)
Include: omutil.xin

Declaration
define function UTIL_SortSwitchesByKey
   modifiable switch switch-shelf 

Argument definitions

switch-shelf
is a keyed shelf of switches


Purpose

Use UTIL_SortSwitchesByKey to sort a shelf of switches by their keys in ascending order.

Requirements

You must include the following line at the beginning of your OmniMark program:

  include "omutil.xin"

switch-shelf must have a key for every switch (else OmniMark Error 6052)

Usage Notes

You may want to write a function to build your keyed switch shelf from your existing data.

Example


  include "omutil.xin"
  process
     local switch my-switch variable initial {true with key "a", 
                                              false with key "c",
                                              true with key "b"}
     UTIL_SortSwitchesByKey my-switch
     
     repeat over my-switch
       output "key " 
          || key of my-switch
          || "; item " 
       do when my-switch
          output "true"
       else
          output "false"
       done
       output "%n"
     again