Item3525: FormQueryPlugin sort by field documentation is incorrect

pencil
Priority: Normal
Current State: Closed
Released In:
Target Release: n/a
Applies To: Extension
Component: FormQueryPlugin
Branches:
Reported By: TWiki:Main.StephaneLenclud
Waiting For:
Last Change By: CrawfordCurrie
I could not get the sort by form field to work for %TABLEFORMAT%. I noticed it was sorting by topic name when I was doing sort="name". Eventually I got it working by doing sort="MyForm.MyField". But then I noticed that numeric sorting and probably reverse sorting are broken anyway. So I came up with a workaround in TableFormat.pm but it probably breaks other kind of sorting. I have a feeling that this should really be fixed in DBCacheContrib/Map.pm get sub.

Anyhow I change a few lines in the _compare function:

        if ( $field->{reverse} ) {
            # reverse sort this field
            $va = $b->get($b->get('form') . '.' . $field->{name} );
            $vb = $a->get($a->get('form') . '.' . $field->{name} );
        } else {
            $va = $a->get($a->get('form') . '.' . $field->{name} );
            $vb = $b->get($b->get('form') . '.' .  $field->{name} );
        }

All I did is adding the concatenation with the form name.

-- TWiki:Main/StephaneLenclud - 29 Jan 2007

Turns out that the whole thing is not broken at all. Only the documentation needs updating. Numeric sorting and I assume reverse sorting work fine when doing something like sort=#MyForm.MyTopic.

-- TWiki:Main.StephaneLenclud - 29 Jan 2007

Item3537 also require FormQueryPlugin documentation update.

-- TWiki:Main.StephaneLenclud - 30 Jan 2007

I can't see anything wrong with the documentation; the requirement to use # for a numeric sort is clearly documented; see http://foswiki.org/Extensions/FormQueryPlugin#SortOrder - I added an anchor link to try and make it clearer.

-- CrawfordCurrie - 07 Apr 2009

ItemTemplate edit

Summary FormQueryPlugin sort by field documentation is incorrect
ReportedBy TWiki:Main.StephaneLenclud
Codebase
SVN Range TWiki-4.1.0, Mon, 22 Jan 2007, build 12595
AppliesTo Extension
Component FormQueryPlugin
Priority Normal
CurrentState Closed
WaitingFor
Checkins TWikirev:13527
TargetRelease n/a
ReleasedIn
Topic revision: r7 - 07 Apr 2009, CrawfordCurrie
The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License    Legal Imprint    Privacy Policy