Gossamer Forum
Home : Products : DBMan : Customization :

sorting fields

Quote Reply
sorting fields
another question about exporting fields (related to other question). i have array $db_export_fields set up, excerpt of code below:

Code:

sub csv_record {
# --------------------------------------------------------
# writes record in CSV format
my (%rec) = @_; # Load any defaults to put in the VALUE field.
# ($db_auto_generate and print &build_html_record(%rec) and return);
my ($test);
@test = split (/\,/, $db_export_fields{$column});
my $num = 0;
foreach $test (%db_export_fields) {
if ($num > 0) {print CSVFILE "|";}
print CSVFILE qq|"$rec{$test}"|;
$num += 1;
}
print CSVFILE "\n";

i can't figure out how the program determines what order to create the columns in the csv file. i would like them listed in the order i have them defined in $db_export_fields. if it can't do that, then i would like them in field number order (as the fields are defined in cfg). right now, they are not in either of those orders, nor are they alphabetical by field name. is it possible for me to set the order like i want?