Gossamer Forum
Home : Products : DBMan SQL : Discussion :

what is column "pos"?

Quote Reply
what is column "pos"?
in the routine that displays records, it refers to ordered_columns. i found the code that sorts the columns by the "pos" which i think i found in the .def file. can the pos in the def files be changed without affecting the data?

sub ordered_columns {
# -----------------------------------------------------------
# $obj->ordered_columns;
# ----------------------
# Returns the current table columns ordered
# in function of the "pos" type of a given
# column.
# The columns having no specified pos are
# appended in lexicographical order at the
# end of the result array.
my $self = shift;
my @cols = ();
my @append = ();
my $cols = $self->{schema}->{cols};
foreach my $col (sort {
$cols->{$a}->{pos} && $cols->{$b}->{pos} ? $cols->{$a}->{pos} <=> $cols->{$b}->{pos} :
$cols->{$a}->{pos} && !$cols->{$b}->{pos} ? -1 :
$cols->{$b}->{pos} && !$cols->{$a}->{pos} ? 1 :
($a cmp $b)
} keys %{$cols}) {
push @cols, $col;

return @cols;
Quote Reply
Re: [delicia] what is column "pos"? In reply to
If its the same as GLinks/GForum, then its the "position" of the field. For example, pos = 1 would show up before pos = 2 in the admin forms (where they are auto generated)


Andy (mod)
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!