CodeKit Code Set Method

Sometimes we need access to a full code data set.

code_set()

$rows = $codekit->code_set($code_set);

The code_set() method returns an array of code row arrays for the code set specified.

Each row consists of the code_code, code_desc, code_order and code_flag fields sorted by code_order and code_code.

Here are some examples that print out the non-deprecated month codes and their descriptions:

# PHP
print "<pre>\n";
$set_list = $codekit->code_set('month');
foreach ( $set_list as $row ) {
    list( $code_code, $code_desc, $code_order, $code_flag ) = $row;
    if ($code_flag == 'd') continue;
    printf("%2d - %s\n", $code_code, $code_desc);
}
print "</pre>\n";
# Perl
print "<pre>\n";
my $set_list = $codekit->code_set('month');
for my $row ( @$set_list ) {
    my ( $code_code, $code_desc, $code_order, $code_flag ) = @$row;
    next if $code_flag eq 'd';
    printf("%2d - %s\n", $code_code, $code_desc);
}
print "</pre>\n";