Tags:
create new tag
view all tags

SID-00800: How to sort numbers in scientific notation in a table plugin

Status: Answered Answered TWiki version: 4.2.0 Perl version:
Category: TablePlugin Server OS: redhat linux 7.2 Last update: 16 years ago

I am using the table plugin and have some columns of numbers that are in scientific notation (like 4.0392e-02, 3.9421e+01, etc.) The current sort will treat these as text and not sort them properly. Is there a way to handle the sorting of this notation?

-- JimKulikowski - 2010-03-29

Discussion and Answer

You should be able to do this by creating a sort key and then hiding it from view. See SearchOrderOnMoreColumns for related information.

In your case, you might be able to simply convert scientific notation to decimal to get a sortable key. But if the exponents are too large you will get overflow problems. In that case, a sortable key could be constructed by reversing the parts: for your examples above, +01E3.9421 > -02E4.0392. If the bases are signed too, then you need another +/- prefix.

-- SeanCMorgan - 2010-03-29

The TablePlugin could be enhanced to support sorting of numbers in scientific notation. If you are a programmer you could provide a patch. In any case, feel free to submit an enhancement request at Bugs:TablePlugin.

-- PeterThoeny - 2010-03-29

      Change status to:
ALERT! If you answer a question - or someone answered one of your questions - please remember to edit the page and set the status to answered. The status selector is below the edit box.
SupportForm
Status Answered
Title How to sort numbers in scientific notation in a table plugin
SupportCategory TablePlugin
TWiki version 4.2.0
Server OS redhat linux 7.2
Web server

Perl version

Edit | Attach | Watch | Print version | History: r3 < r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r3 - 2010-03-29 - PeterThoeny
 
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2026 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.