Feature Proposal: Add $total(..) to FormattedSearch

Motivation

We lack a way of emitting this format string:

format="Record $index of $total" where it should say, "1 of 4", "2 of 4", "3 of 4", ...

The example is trivial, but we have cases at work where we want to build (non-human) identifiers in the generated markup based on a function of the total number and the $index.

This would also fix the problem that we can't put the search total in the header.

Description and Documentation

Previous discussion at AddNumberOfTopicsToFormattedSearch. I've added SvenDowideit as a contributor as I've borrowed the $param($foo) syntax he mentioned in that discussion.

Some rationalisation of the formatting code might be necessary.

Implement the following:
  • $total, $total() - total topics
  • $total(group) - total topics in this group (Eg. groupby="web")
  • $total(sofar) - topics so far; alias for $ntopics and $index
  • $total(groupsofar) - topics so far in this group/web
  • $total(hits) - total hits
  • $total(grouphits) - total hits in this group/web
  • $total(hitssofar) - total hits so far; alias for $nhits
  • $total(grouphitssofar) - total hits so far in this group/web

Examples

Impact

%WHATDOESITAFFECT%
edit

Implementation

-- Contributors: PaulHarvey - 17 Jan 2011, SvenDowideit

Discussion

No objections. Excellent? smile

-- PaulHarvey - 05 Feb 2011

there might be one small issue...

you might need to make it $total(group), so that it doesn't get pre-evaled mistakenly (and tbh, i think it might make more sense to allow both format evals inside the braces and named values as in the spec above.

and if there's a possibilty of $total(cells(above),) and $total(cells(column)) etc we might be able to do away with some CALC

yes, I did BikeShed - ignore the idea unless you happen to notice its magically doable - or toss a comment in the code where you think it'd go.. (cos the unit tests will be monstrous)

-- SvenDowideit - 05 Feb 2011

I had wondered about that. I've removed the dollars. Reset the date again.

The number of macros I'm maintaining which do header/format/footer is saddening. Doing TopicRecursePlugin gave me some ideas.

-- PaulHarvey - 06 Feb 2011

yes, likewise - I almost extracted the Seach::FormatResults code into a Func yesterday for the same reason

-- SvenDowideit - 06 Feb 2011

Changing to Parked, needs a developer to adopt.

-- GeorgeClark - 19 Nov 2015
Topic revision: r8 - 19 Nov 2015, GeorgeClark
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